Skip to content

Ubuntu - On the Cloud

Ubuntu - Deploying on Cloud Platforms (e.g., AWS)

Section titled “Ubuntu - Deploying on Cloud Platforms (e.g., AWS)”

Ubuntu is a very popular operating system for cloud computing. Major cloud providers like Amazon Web Services (AWS), Google Cloud Platform (GCP), and Microsoft Azure offer official Ubuntu Server images, making it easy to deploy virtual machines (VMs) running Ubuntu. This chapter provides a general guide on deploying an Ubuntu VM on AWS EC2 (Elastic Compute Cloud). The concepts are similar for other cloud providers.

General Steps to Launch an Ubuntu VM on AWS EC2

Section titled “General Steps to Launch an Ubuntu VM on AWS EC2”

Step 1 − Create or Log In to Your AWS Account. Visit the AWS website (aws.amazon.com) and sign up for an account if you don’t have one. AWS offers a Free Tier that includes limited use of EC2 instances, which is great for learning.

Step 2 − Navigate to the EC2 Dashboard. Once logged into the AWS Management Console, search for ‘EC2’ in the services search bar and select it. This will take you to the EC2 dashboard.

Step 3 − Launch a New Instance. On the EC2 dashboard, look for a button like ‘Launch instance’ and click it. This starts the instance creation wizard.

Step 4 − Choose an Amazon Machine Image (AMI). An AMI is a pre-configured template for your instance. In the ‘Name and tags’ or ‘Application and OS Images (Amazon Machine Image)’ section:

  • Search for ‘Ubuntu’.
  • Select an official Ubuntu Server LTS (Long-Term Support) version. LTS versions are recommended for stability (e.g., Ubuntu Server 22.04 LTS, Ubuntu Server 24.04 LTS). Ensure it’s marked as ‘Free tier eligible’ if you want to stay within the free usage limits.

Step 5 − Choose an Instance Type. This defines the hardware resources (CPU, memory, storage) for your VM. For beginners or Free Tier usage, select an instance type like t2.micro or t3.micro (if available and marked as Free Tier eligible).

Step 6 − Configure Key Pair (for SSH access). This is crucial for securely connecting to your instance. You’ll typically have options to:

  • Create a new key pair: Give it a name (e.g., my-aws-key). AWS will generate a private key file (e.g., my-aws-key.pem). Download this .pem file immediately and store it securely. You will NOT be able to download it again.
  • Use an existing key pair: If you’ve created one before.

Step 7 − Configure Network Settings (Security Group). A security group acts as a virtual firewall. It’s vital to configure it correctly:

  • Create a new security group or select an existing one.
  • For SSH access, ensure there’s an inbound rule allowing TCP traffic on port 22. For better security, set the ‘Source’ to ‘My IP’ to only allow connections from your current IP address. If your IP changes often, you might use ‘Anywhere’ (0.0.0.0/0) for testing, but this is less secure for production.
  • If you plan to run a web server, you’ll also need to allow HTTP (port 80) and/or HTTPS (port 433) traffic.

Step 8 − Configure Storage. The default storage settings (usually a small General Purpose SSD volume) are often sufficient for basic needs. You can adjust the size if required.

Step 9 − Review and Launch. Review your instance configuration summary. If everything looks correct, click the ‘Launch instance’ button.

Step 10 − Access Your Instance. After a few minutes, your instance state should change to ‘running’ in the EC2 console. Select your instance to view its details, including its ‘Public IPv4 address’ or ‘Public IPv4 DNS’.

To connect via SSH (from your local machine’s terminal):

chmod 400 /path/to/your-key-name.pem
ssh -i /path/to/your-key-name.pem ubuntu@your_instance_public_ip_or_dns
  • Replace /path/to/your-key-name.pem with the actual path to your downloaded private key file.
  • The chmod 400 command sets restrictive permissions on your key file, which SSH requires.
  • The default username for official Ubuntu AMIs on AWS is usually ubuntu.

You should now be connected to your Ubuntu Server instance in the cloud. You can install software, configure services, and manage it just like any other Ubuntu server.

Important: Remember to stop or terminate your EC2 instances when you’re not using them to avoid unexpected charges, especially if you go beyond the Free Tier limits.