Port 22 connection timed out

m trying to get onto my P2.xlarge instance using below
ssh -i /home/akatti/.ssh/aws-key-fast-ai.pem ubuntu@ec2-52-25-240-66.us-west-2.compute.amazonaws.com

Im getting message
OpenSSH_7.5p1, OpenSSL 1.0.2k 26 Jan 2017
debug1: Connecting to ec2-52-25-240-66.us-west-2.compute.amazonaws.com [] port 22.
debug1: connect to address port 22: Connection timed out
ssh: connect to host ec2-52-25-240-66.us-west-2.compute.amazonaws.com port 22: Connection timed out

Unable to get started. Please help

Are you absolutely sure that’s the name of your AWS instance? The connection time out usually means:
0) Your instance is not actually running (you may have forgotten to start it up again via the AWS console);

  1. The SSH daemon is not running on the instance you’re trying to reach;
  2. If the SSH daemon is running, then your firewall settings may have been modified to block port TCP22.

You can check #0 above by logging into your Amazon Web Services (AWS) console, right clicking on the machine and trying to SSH via the built-in Java SSH browser client. Make sure not to use Chrome - a warning will pop up from Amazon if you try to do so.

Hope this helps.

Thanks the public DNS showing up was different than the one it asked me to SSH in through. Used the latest IP and was able to log in

I’m having a similar issue, but the error message is slightly different.

When I ssh into my running AWS P2Xlarge instance (I checked it is running), using :

ssh -i /home/MYUSERNAME/.ssh/aws-key-fast-ai.pem ubuntu@ec2-52-38-124-131.us-west-2.compute.amazonaws.com

I get the following message:

connection closed by port 22

Any ideas what this might mean and how to fix it?

Also I previously installed -and was able to run- a t2 instance in AWS, so I am not sure what the problem might be with the P2 instance now.


It turns out I needed to terminate my instance and re-create it.
I also deleted a few VPCs that had been created by previous attempts and it all works now