This content originally appeared on DEV Community and was authored by Augustine Okwaraebuzie
INTRODUCTION
Amazon EC2 (Elastic Compute Cloud) provides scalable computing capacity in the AWS cloud. By launching an Ubuntu EC2 instance, you’re essentially creating a virtual server on the cloud that can run applications, host websites, and perform development/testing activities. Ubuntu is a popular Linux distribution due to its security, open-source nature, and ease of use.
This guide walks you through each step, from logging into AWS to connecting to your Ubuntu server.
Step-by-Step Process to Launch an Ubuntu EC2 Instance
Requirements
To begin, make sure you have the following:
An active AWS account
An Installed text editor like (Powershell)
SSH client (e.g., Terminal on macOS/Linux, PuTTY on Windows)
Step 1: Log in to AWS Management Console
Go to https://aws.amazon.com
Click on Sign In to the Console
Enter your username and password
Step 2: Navigate to EC2 Dashboard
On the AWS Console, search for EC2 in the “Find Services” bar.
Click on EC2 under “Compute”.
The EC2 Dashboard shows all running instances, volumes, security groups, and key pairs.
Step 3: Click “Launch Instance”
In the EC2 Dashboard, click the “Launch Instance” button.
You’ll be taken to the instance creation wizard.
Step 4: Name Your Instance
In the “Name and tags” section, type a name like: Ubuntu-Web-Server.
Step 5: Choose an Amazon Machine Image (AMI)
In the “Application and OS Images” section:
Click “Browse more AMIs”
In the search bar, type Ubuntu
Choose an Ubuntu Server (e.g., Ubuntu Server 22.04 LTS)
Make sure it says Free Tier eligible (if you’re using the free tier)
Step 6: Choose an Instance Type
Select t2.micro (eligible for Free Tier: 1 vCPU, 1GB RAM).
For more power, choose higher specs—but note, it may incur charges.
Step 7: Create (or Use) a Key Pair
A key pair lets you securely SSH into your instance.
Choose Create new key pair
Give it a name: ubuntu-key
Select .pem as file format
Click Create key pair — a file will download (save this safely)
You won’t be able to download the key again. Keep it secure and don’t lose it.
Step 8: Configure Network Settings, Review and Launch
Choose or leave the default VPC and subnet
Under “Firewall (security groups)”, choose:
Create security group
Allow SSH (port 22) from your IP
Optional: Add HTTP (port 80) if you’re hosting a web server
Click on Launch
Check Configure Storage and leave it on default
You will see a successful message, scroll down and click on “view instance” to go to dashboard.
Step 9: Connect to Your Ubuntu EC2 Instance via PowerShell
- Open your terminal and run the command from the directory containing your .pem file.
- Copy the SSH command that looks like: ssh -i “ubuntu-key.pem” ubuntu@your IP address
- Accept the connection (type yes)
Step 10:Installing and configuring NGINX Web Server
Installing NGINX: Enter the command “sudo apt install nginx -y”
Note that “nginx” is the web server software
“-y” means you agree to install without asking again
Start NGINX: Enter the command “sudo systemctl start nginx”
This is to start nginx server
Check NGINX status: Enter the command “sudo systemctl status nginx”
This shows if NGINX is running properly
Enabling NGINX to Auto-start: Enter the command “sudo systemctl enable nginx”
This ensures NGINX starts automatically if the server restarts
Step 11: Testing and Customizing the Web Page
Testing: Open your browser and login to http//:(your-ec2-IP)
You will see the default NGINX welcome page.
Editing the web page: Enter the command
“sudo /var/www/html/index.nginx-debian.html” . This is to open the default web page file that NGINX shows to visitors, the files are stored in the /var/www/html folder on the server
Steps to Edit:
- Delete the existing text in the file by holding the ctrl key and press K repeatedly (deletes lines one after the other).
- Type this:
You should see the NGINX web page in this effect
Conclusion
You’ve successfully launched and connected to an Ubuntu EC2 instance! From here, you can install software, host websites, configure firewalls, and much more — all from a scalable cloud environment.
This content originally appeared on DEV Community and was authored by Augustine Okwaraebuzie