Mendes
Mendes

Reputation: 18561

Can´t connect to my Amazon EC2 instance. It pings but connection times out

I did setup my 1st EC2 instance on AWS on a free tier using Ubuntu as the OS. I followed all the steps and my instance is up.

I´ve build the following security rules:

Ports   Protocol    Source  Personal_SG_NVirginia
80      tcp         0.0.0.0/0   ✔
22      tcp         0.0.0.0/0   ✔
3306    tcp         0.0.0.0/0   ✔
443     tcp         0.0.0.0/0   ✔
-1      icmp        0.0.0.0/0   ✔

I can ping my instance, but cannot connect to it either using PuTTY, ssh on my linux and even on miniterm console.

$ ssh -vv -i "xxxx.pem" [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 52.91.95.205 [52.91.95.205] port 22
debug1: connect to address 52.91.95.205 port 22: Connection timed out
ssh: connect to host 52.91.95.205 port 22: Connection timed out

Tha same happens if I use DNS name.

Miniterm console error:

Connection to 52.91.95.205: Connection timed out: no further information

I have already restarted the instance and recreated it, but no success at all.

Help appreciatted.

Upvotes: 0

Views: 1372

Answers (1)

Matt Beckman
Matt Beckman

Reputation: 5012

Verify the IP address is valid

$ ssh -vv -i "xxxx.pem" [email protected]

Is this hand-written or did you copy and paste? The IP address is an invalid IP address ("1133" is >255), and doesn't match your debug output. Make sure you're connecting to the correct public IP address of the instance.

Verify you are using the correct user

Are you sure the initial user is "ubuntu"? Some EC2 Linux instances use "ec2-user" for the initial setup.

Try: ssh -vv -i "xxxx.pem" [email protected]

Verify default SSH port is not blocked (correct solution)

Per discussion below, it turns out that port 22 was blocked by the user's ISP. Switching to a non-standard port (2022) resolved the issue.

Upvotes: 1

Related Questions