Why Can't I Connect to my EC2 instance?

Dan | Jan 2, 2023 min read

Problem: I recently received an error while attempting to SSH into an EC2 instance. The error specifically said “ssh: connect to host ec2-XX-XXX-XX-XXX.compute-1.amazonaws.com port 22: Operation timed out” I checked the normal issue areas (connected to internet gateway and no unhealthy status checks) and all looked good.

Solution: In looking at the instance’s security group more closely, I noticed that the inbound rule for SSH was restricted to a specific IP address. I recently came back from vacation. My IP address likely changed while I was travelling. By updating the inbound rule to allow connection from my IP address, I was able to connect to the instance.