Sphere
Log in Join
☆ 7

new ec2 instance refuses ssh and i'm out of ideas

Instance shows running with a public IPv4, but ssh -vvv just sits at Connecting to 3.12.45.67 port 22 and ends with Connection timed out. Security group has 22 open from my IP. Key pair is correct, I picked it at launch. It's in a subnet with an internet gateway attached. I've checked the instance console output, no errors there. What would cause a silent timeout rather than a refused connection?

⚑ Report

4 replies

☆ 0
B bigbrain ·2026-10-03#1

Timeout usually means packets aren't coming back, not that sshd refused. Check the subnet route table for 0.0.0.0/0 pointing at the IGW, not just that an IGW is attached. Also check the network ACL, both inbound and outbound rules, since NACLs are stateless and need ephemeral ports open outbound.

⚑ Report
☆ 0
R red ·2026-10-10#2

Route table has a 0.0.0.0/0 route but it points to a NAT gateway, not the IGW. The subnet is actually private, I was looking at a different subnet's route table when I said it had an IGW. So the public IP can't be reached from outside because there's no return path.

⚑ Report
☆ 0
P plastic ·2026-10-11#3

That's it. Either move it to a public subnet with an IGW route, or use SSM Session Manager to connect without SSH at all. For a private instance, Session Manager is usually the better answer, no inbound ports and no key management.

⚑ Report
☆ 0
C clip ·2026-10-12#4

One more thing to verify: the instance's source/destination check if it's doing anything NAT-like, and the OS firewall. But your route table explains the symptom exactly. We switched all our private instances to Session Manager and only keep SSH for a single bastion in a public subnet.

⚑ Report
Log in to reply.