How to Launch a Linux EC2 Instance on AWS

Part 1: Access the EC2 Dashboard

  1. Log in to your AWS Console
  2. Search for EC2 in the top search bar
  3. Click “Instances” in the left menu
  4. Click “Launch Instances” button

Part 2: Configure Your EC2 Instance

1. Name your instance

  • Example: my-linux-server

2. Choose an Amazon Machine Image (AMI)

  • Select: Amazon Linux 2 AMI (free tier eligible)
    (You can also choose Ubuntu if preferred)

3. Choose an Instance Type

  • Select: t2.micro (free tier eligible)

4. Key Pair (Login)

  • Choose an existing key pair or create a new one:
    • Name it my-key-pair
    • Select .pem (for Linux/macOS) or .ppk (for Windows with PuTTY)
    • Download and keep it safe

5. Network Settings

  • Allow SSH (port 22) from your IP only (for security)
  • Optionally, allow HTTP (port 80) if you plan to install a web server

6. Storage

  • Leave the default: 8 GiB General Purpose SSD (gp2)

Part 3: Launch the Instance

  1. Review your configuration
  2. Click “Launch Instance”
  3. Wait for the Instance State to show “Running”

Part 4: Connect to Your Instance

For Linux/macOS:

bashCopiarEditarchmod 400 my-key-pair.pem
ssh -i my-key-pair.pem ec2-user@<your-public-ip>

For Windows:

  • Use PuTTY or Windows Terminal
  • Convert .pem to .ppk if needed (with PuTTYgen)
  • Connect using the public IP

Part 5: Post-Launch Tasks

1. Update the instance

bashCopiarEditarsudo yum update -y     # Amazon Linux
# or
sudo apt update && sudo apt upgrade -y  # Ubuntu

2. Install a Web Server (Optional)

bashCopiarEditarsudo yum install httpd -y     # Amazon Linux
sudo systemctl start httpd
sudo systemctl enable httpd

Then visit your instance’s public IP in a browser — you should see the default Apache page.

You May Have Missed