EC2 SSH Connection Timed Out

Share
Ongoing Linux, macOS, Windows Updated November 13, 2026Based on 4 user reportsHow we research

Quick answer

A timeout means traffic never reaches the instance: fix the security group inbound rule for port 22, the subnet route to an internet gateway, network ACLs, or the missing public IPv4 address.

Most likely fix: Check the instance is ready

How to fix it

Try these in order — the most common fix is first.

  1. 1. Check the instance is ready

    1. EC2 > Instances: state must be running and status checks passed
    Did this fix it?
  2. 2. Fix the security group

    1. Select the instance > Security tab > Inbound rules
    2. Add a rule: SSH, TCP 22, source = your public IP (or range if your IP changes)
    Did this fix it?
  3. 3. Fix routing

    1. Instance > Networking tab, note VPC and subnet
    2. VPC > Subnets > Route table: need 0.0.0.0/0 to the internet gateway (::/0 for IPv6)
    3. Confirm an internet gateway is attached to the VPC
    Did this fix it?
  4. 4. Check network ACL and public IP

    1. VPC > Subnets > Network ACL tab: allow inbound 22 and outbound 1024-65535
    2. Associate an Elastic IP if the instance has no public IPv4
    Did this fix it?
  5. 5. Use another way in

    1. Try EC2 Instance Connect from the console, or Systems Manager Session Manager
    2. Check CloudWatch CPU in case the instance is overloaded
    Did this fix it?

Symptoms

ssh hangs and ends with 'Connection timed out' or 'Network error: Connection timed out'.

Why it happens

  • Security group has no inbound rule for port 22 from your IP
  • Your IP changed so a single-IP rule no longer matches
  • Subnet route table lacks 0.0.0.0/0 to an internet gateway
  • Network ACL blocks port 22 or ephemeral return ports
  • Instance has no public IPv4 address
  • Corporate firewall blocks port 22
  • Instance not running or failing status checks

This guide also covers

  • ec2 ssh connection timed out
  • aws ec2 cannot ssh
  • ssh to ec2 timeout
  • can't connect to ec2 instance

Still not working?

If AWS keeps failing, you're not alone. See every AWS problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All not loading, error messages & connection guides →

Other AWS errors

All 11 AWS errors and fixes →