Connection timed out
- Meaning
- No answer: dropped by a security group, route, NACL or firewall, or no public address
- Go to
- This page
Fix SSH to EC2 failing with Connection timed out. Check the security group, route table, network ACL, public IP and firewalls in order, with commands to test each.
An EC2 connection timed out means your packets got no answer at all: something between you and the instance dropped them silently. AWS's checklist, in order: a security group rule allowing your public IP on port 22, a route to an internet gateway, a network ACL that allows port 22 in and ephemeral ports 1024-65535 out, a public IPv4 address, and no local firewall in the way.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
Network error: Connection timed out and Error connecting to [instance], reason: -> Connection timed out: connect.you --> [your firewall] --> internet --> [route table + internet gateway]
--> [network ACL on subnet] --> [security group on instance] --> sshd :22nc -vz -G 5 192.0.2.1 22
# observed on macOS: nc: connectx to 192.0.2.1 port 22 (tcp) failed: Operation timed outssh -o ConnectTimeout=5 -o BatchMode=yes ubuntu@192.0.2.1
# observed: ssh: connect to host 192.0.2.1 port 22: Operation timed outcurl -s https://checkip.amazonaws.com
# prints the public IPv4 address your traffic leaves from0.0.0.0/0 as destination and the VPC's internet gateway as target. For IPv6, a route for ::/0 to the same gateway. Also confirm an internet gateway is attached to the VPC.Also confirm the instance is in the running state and has passed its status checks. A just-launched instance can take a few minutes before it accepts connections.
--dry-run first: EC2 commands accept it and report whether you have permission without changing anything.aws ec2 authorize-security-group-ingress \
--group-id sg-0123456789abcdef0 \
--protocol tcp --port 22 \
--cidr 203.0.113.25/32 \
--dry-runaws ec2 create-route \
--route-table-id rtb-0123456789abcdef0 \
--destination-cidr-block 0.0.0.0/0 \
--gateway-id igw-0123456789abcdef0 \
--dry-runSSH timing out does not affect crawlers, but a missing rule on ports 80 or 443 produces the same silence for visitors. Google treats network timeouts, connection resets and DNS errors similarly to 5xx server errors, and crawling immediately starts slowing down. Indexed URLs that stay unreachable can be removed from the index within days. Google's suggested checks include overly broad firewall rules, so review security group and ACL rules for web ports as carefully as for SSH. Related reading: timeout errors and Lambda timeouts.
4 questions people ask next, answered from the sources on this page.
Running only means the instance is up. A timeout means traffic is dropped before it reaches sshd, most often by a security group with no rule for your current IP, a missing internet gateway route, a network ACL, or a firewall on your network.
Inbound port 22 from your IP, and outbound traffic to the ephemeral ports 1024-65535. AWS says ACLs must allow both.
If the security group rule names a single IP and your address is not static, it changes after a restart or when your ISP reassigns it, so the rule no longer includes you.
Yes, AWS lists checking that the instance has a public IPv4 address. If it has none, you can associate an Elastic IP address.
Run the free audit, then approve the fixes. Every change can be undone.