AWS Builder Center
Why Can’t My EC2 Connect to the Internet?

Why Can’t My EC2 Connect to the Internet?

A beginner-friendly guide troubleshooting why a newly launched EC2 instance cannot access the internet or accept SSH connections, featuring a practical 3-step routing and security checklist.

If you are new to AWS, you have likely run into this exact scenario: you launch an Amazon EC2 instance inside a custom Virtual Private Cloud (VPC), configure your security groups, attempt to connect via SSH or run  sudo apt update , and the terminal completely hangs.
Everything seems properly configured, yet traffic refuses to flow.
This is the most common roadblock for cloud beginners. Let's break down why this happens and how to fix it in 3 quick steps.
The 3-Point Checklist to Fix It
  1. Verify the Internet Gateway Attachment
Navigate to VPC > Internet Gateways.
Ensure an Internet Gateway exists and its state says Attached to your specific custom VPC, not Detached.
  1. Update the Subnet Route Table
Open VPC > Route Tables and select the route table associated with your subnet.
Go to the Routes tab and click Edit routes.
Add the following entry:
Destination: 0.0.0.0/0
Target: Select Internet Gateway (choose your attached igw-xxxx).
Save changes.
  1. Check Inbound and Outbound Security Groups
In Inbound rules, allow port 22 (SSH) or port 80/443 (HTTP/HTTPS) from your specific IP.
In Outbound rules, ensure the default rule allowing all traffic (0.0.0.0/0 on all ports) is present. If outbound traffic is blocked, your instance cannot respond to incoming connection requests or download system updates.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article