Skip to main content

Command Palette

Search for a command to run...

Provisioning and Connecting to an EC2 Ubuntu Instance on AWS (Level 1)

Updated
2 min read

As part of my journey into AWS and DevOps, today’s task was to launch an EC2 Ubuntu instance and connect to it securely using SSH. This is a basic but critical building block for deploying cloud-native systems, running automation scripts, or hosting services.


Objective

  • Provision a virtual machine using EC2

  • Configure networking and key pair for secure access

  • Connect via SSH

  • Identify and resolve real-world issues during setup


Step-by-Step: EC2 Instance Launch

From the AWS Management Console:

  • AMI: Ubuntu Server 24.04 LTS (HVM)

  • Instance type: t2.micro (Free tier eligible)

  • Key Pair: Created new key ubuntuServer-1.pem

  • Security Group: Opened port 22 (SSH) for my IP

  • Storage: Default 8 GB

Launched the instance and verified that it moved into the “Running” state.

Instance Running


SSH Connection Steps

AWS provides a one-click SSH instruction under the Connect tab. I followed these instructions:

chmod 400 ubuntuServer-1.pem
ssh -i "ubuntuServer-1.pem" ubuntu@ec2-15-207-177-77.ap-south-1.compute.amazonaws.com

Connection Instructions


Issue Faced: SSH Connection Timeout

Initially, I faced an error:

ssh: connect to host ec2-15-207-177-77.ap-south-1.compute.amazonaws.com port 22: Connection timed out

Troubleshooting Process:

  • Verified security group had SSH (port 22) open to my IP — confirmed ✔

  • Checked key permissions using chmod 400 — confirmed ✔

  • Validated Public IP in EC2 details — matched ✔

  • Issue: My local firewall had outbound connections blocked on port 22.

Fix:

  • Temporarily disabled firewall to test.

  • Once confirmed, added a firewall rule to allow outbound SSH (port 22) connections.

  • Re-ran the SSH command and successfully connected.


Logged Into Ubuntu Server

Once connected, I verified:

  • OS version: Ubuntu 24.04.2 LTS

  • System metrics: CPU, memory, and load

  • Network: Confirmed private IP, public IP, and hostname

📸 SSH Terminal


🧠 Key Takeaways

  • SSH troubleshooting is a practical skill — cloud engineers often deal with networking/firewall misconfigurations.

  • Default security group and firewall configurations must be reviewed thoroughly.

  • AWS’s connection tab offers reliable guidance if used carefully.

  • Always verify:

    • Security Group rules

    • Key permissions

    • Correct user (ubuntu for Ubuntu AMIs)

    • Public DNS/IP match

More from this blog

Documenting My DevOps Journey

40 posts