This guide walks you through creating a cloud-based Linux server (EC2 instance) on AWS and connecting to it securely via SSH from your local machine. Perfect for beginners learning cloud infrastructure, DevOps, or Linux administration.
- A valid AWS account (Create one here)
- A local computer (Windows/macOS/Linux)
- Internet access
- Sign in to AWS Console
- Navigate to:
Services→ EC2 - On the left sidebar, click Instances
- Click Launch instance
- Choose an Ubuntu Server (Free tier eligible)
- Follow default configuration, name your instance, and download your
.pemkey file securely - Launch the instance
Windows:
- MobaXterm ✅ recommended
- Git Bash
- PuTTY
- PowerShell
macOS/Linux:
- Use built-in Terminal
- Move your downloaded
.pemfile to a safe location (e.g.Downloadsfolder) - Open Terminal (or MobaXterm)
- Navigate to the
.pemfile:
cd ~/Downloads- Make your
.pemfile readable only by you (Linux/macOS only):
chmod 400 ubuntu.pem- Connect to your EC2 instance using:
ssh -i "ubuntu.pem" ubuntu@<PUBLIC_IP_ADDRESS>📝 Replace <PUBLIC_IP_ADDRESS> with the actual IP shown in your EC2 dashboard.
📷 Expected Output on Successful Connection:

Ubuntu/Debian:
sudo apt updateRed Hat/Fedora (optional):
sudo yum updateUbuntu/Debian:
sudo apt install treeRed Hat/Fedora:
sudo yum install tree✅ To verify:
tree ~/Downloadssudo apt upgradesudo apt remove treeInstall nginx on your Ubuntu server:
sudo apt install nginxThen verify by checking the Nginx service:
systemctl status nginxYou now know how to:
- Launch and configure a Linux server on AWS
- Securely connect using SSH
- Use Linux package managers (apt/yum)
- Install, verify, and remove packages
