ssh operation timed out


Hi, I am getting an error (ssh: connect to host port 22: Operation timed out) when trying to ssh into EC2 instance.

Update: SOLVED! Details: Thankyou everyone for your quick help. My instance was running initially but it stopped running eventually. Maybe because I abruptly exited out of it (with ctrl +D). I tried deleting the instance and create a new one but it did't run. Now, I am running a new instance in a different region. This has solved the problem.

asked 2 years ago3502 views
3 Answers


First of all, I recommend you do not post the Machine IP address publicly it is not best practice. I understand that you are not able to connect Ec2 instance ssh,

Please verify below points :

  1. Check Your Ec2 instance is having **2/2 Health Check passed **
  2. Check Security Group of Ec2 instance port is allowed from your Source Ip , Security Group must allow inbound rule Port 22 to your IP or , Link to add SG
  3. Check if your Subnet, If it is public check Internet Gateway attached to it, Link
  4. Ping IP adress if you are able to ping the IP

General Information How to Connect to Ec2 instance ...!

If everything is Looks good, You should able to acess the Ec2 instance

profile picture
answered 2 years ago

There are a few reasons why you might be getting this error, but the first thing to check is that the security group attached to the instance allows ingress traffic on port 22 from the IP address you're trying to connect from.

If that doesn't work, there are a few more solutions to try here:

answered 2 years ago

To add to the other answers, using the VPC Reachability Analyzer ( may be able to track down the reason that you are unable to connect to your ec2 instance.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions