SSH and Telnet to AWS EC2 Instance Timing Out – Troubleshooting

amazon ec2amazon-web-servicessshtimeout

I can't connect to my AWS EC2 Ubuntu instance. I appear to have the address and user right, the security group allows connections on all ports, and I'm using the right key pair. SSH and telnet keep timing out, though. I don't know what I'm doing wrong. Suggestions? I'm quite new to AWS.

Best Answer

Make sure your security groups are fully set up properly.

Each rule in a security group consists of 3 parts

  • the protocol (TCP,UDP,etc),
  • the port range,
  • and the source IP address.

Protocol / Range

The first two can also be set via common protocols (SSH, SMTP, etc).

IP Address

There are three options for the IP address:

  • "Anywhere",
  • "My IP",
  • and "Custom IP".

The IP ranges are all in CIDR format, so if you select "Anywhere" it will fill the address field with 0.0.0.0/0. If you choose "My IP" it will set it to your IP address as a /32. If you choose "Custom IP" (which is the default) then you'll have to fill in your own address in CIDR format.

Anywhere

"Anywhere" does exactly what it says and will allow connections from any source IP address.

My IP

"My IP" will populate the rule with the IP address that you're currently using to connect to AWS.

Custom IP

"Custom IP" lets you specify a custom IP range.

Related Topic