DEV Community

Cover image for Deploying Ubuntu CLI Instance on AWS EC2: A Step-by-Step Walkthrough
adegbola adeniyi
adegbola adeniyi

Posted on

Deploying Ubuntu CLI Instance on AWS EC2: A Step-by-Step Walkthrough

Introduction

Cloud computing has transformed from a luxury for tech giants into a fundamental playground for developers and enthusiasts alike. Whether you're looking to host a web application, run automated scripts, or simply tinker with a powerful Linux environment, Amazon Web Services (AWS) provides the industry-standard infrastructure to make it happen.

At the heart of this infrastructure is Amazon EC2 (Elastic Compute Cloud), a service that lets you launch virtual servers in minutes. When paired with Ubuntu, arguably the most popular and user-friendly Linux distribution for servers, you get a robust, secure, and highly flexible environment managed entirely through the Command Line Interface (CLI).

In this walkthrough, we’ll skip the fluff and dive straight into the technical process of:

  • Provisioning a fresh Ubuntu instance within the AWS Free Tier.
  • Connecting to your server from your local machine using SSH.

Step 1: Access the EC2 Dashboard
AWS
Log in to your AWS Management Console.In the top search bar, type "EC2" and select the EC2 service from the dropdown. Click on Dashboard under the top features to view your current resources.

Step 2: Navigate to Running Instances
AWS
On the EC2 Dashboard, locate the Resources section. Click on Instances (running) to view your active virtual servers.

Step 3: Initialize Instance Launch
AWS
In the Instances window, click the orange Launch instances button located in the top right corner.

Step 4: Configure Name and Tags
AWS
Under the Name and tags section, provide a name for your server. In the Value field, enter a name like "AWSVNEC2".
Ensure the Resource types include Instances to apply this tag correctly.

Step 5: Select the Ubuntu OS
AWS
In the Application and OS Images section, select Ubuntu from the Quick Start icons. From the dropdown menu, select Ubuntu Server 24.04 LTS (HVM). Look for the Free tier eligible label to ensure you aren't charged for the software image.

Step 6: Choose Instance Type
AWS
In the Instance type section, select t3.micro (or t2.micro). Verify it is marked as Free tier eligible.

Step 7: Create a Security Key Pair
AWS
Click Create new key pair to open the setup window. Key pair name: Enter a name like "awsvmec2key". Key pair type: Select RSA. Private key file format: Select .pem. Click Create key pair to download the file to your computer.

Step 8: Network and Storage Settings
AWS
AWS
Under Network settings, ensure Create security group is selected and Allow SSH traffic from Anywhere (0.0.0.0/0) is checked.
Under Configure storage, keep the default 8 GiB of gp3 root volume, which is well within the 30 GB free tier limit.

Step 9: Launch and Review
AWS
AWS
Review the Summary panel on the right. Click the orange Launch instance button. Once you see the green Success banner, click the Connect to instance button.

Step 10: Access the CLI
AWS
AWS
On the Connect to instance page, select the EC2 Instance Connect tab. Ensure the username is "ubuntu" and click Connect.
A new browser window will open, providing a direct terminal interface to your live Ubuntu server.

In conclusion, deploying an Ubuntu instance on AWS EC2 is a straightforward process that provides a powerful, scalable environment for your projects. By successfully navigating the AWS Console, configuring your machine specifications, and securing your access with a private key pair, you have laid the foundation for professional cloud computing.

With your instance now active and accessible via the CLI, you are ready to install software, host applications, and explore the full potential of the Linux ecosystem in the cloud.

Top comments (0)