I've got an EC2 instance running on AWS:

  1. It's an Ubuntu linux instance, and up until not long ago I used putty to access it on a regular basis - worked great.
  2. I'm using Pageant to load the .ppk file (converted it from AWS's original .pem file as per the AWS docs).
  3. I'm using these login settings: Putty Login Settings
  4. Checked that my securtiy group for the instance allows SSH access on port 22 from my address - it does indeed.
  5. Checked that my elastic IP did not change - it did not.
  6. Tried to login into the Public DNS instead of the IP - no cigar.
  7. Rebooted the instance and waited 15 minutes while making tea.

Having said that, I'm getting a "network error: connection timed out" error.

Putty Fatal Error

What can cause this?

  • Firewall get turned on? SSH server not running? Lots of things can cause this. Dec 16 '14 at 18:24
  • I'd Imagine. But what specifically? Throw me some bones here, I'm kinda dumbfounded.
    – Tom Granot
    Dec 16 '14 at 18:25
  • Did you check the System Log in the AWS console? From the EC2 Instances screen, click the Action button and then "Instance Settings", "Get System Log". Look for any error there. Dec 16 '14 at 20:10
  • Not sure what to look for exactly. It's a HUGE log.
    – Tom Granot
    Dec 16 '14 at 21:59
  • Do you see anything related to OpenSSH? You should at least see a line like this:Starting OpenSSH server [ OK ] Dec 16 '14 at 22:01

So, It was a secuity group issue at the end.

AWS makes you include every IP you want to SSH into your server from in a special "group" of permissions to access the server. Otherwise it blocks you from enetering it. Super-good for protection on production servers, bad when accessing your dev server from cafes in the middle of nowhere.

Some more about Security Groups in the AWS Docs (Only for VPC - that's what I use)


Error connecting to your Ec2 instance: Connection timed out

Have you faced Fatal Error while accessing your AWS EC2 instances? What are the alternatives if the SSH access fails to the EC2 instance?

Firstly, you will check the security groups and network connectivities to the instance, once it’s ok, then you need to try and connect to the instance using AWS SSM Session Manager if all the prerequisites are met.

enter image description here

If you try to connect to your instance and get an error message Network error: Connection timed out or Error connecting to [instance], reason: -> Connection timed out: connect, try the following:

Check your Aws security group rules that is attached to your Ec2 Instance.

You need a security group rule that allows inbound traffic from your public IPv4 address on the proper port for ssh connection you have to enter Port 22 as shown in Screenshot.

enter image description here

If you already allow port number 22 in your AWS Security Group then check your connection with Aws Ec2 instance through Telnet command

sunnysharma@SMSUNNIK.local:~$ telnet 22
Connected to ec2-53-22-22-19.compute-1.amazonaws.com.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
Connection closed by foreign host.

enter image description here

Each time you restart your instance, a new IP address (and host name) will be assigned to your Ec2 Instance.

If your computer is on a corporate network, ask your network administrator whether the internal firewall allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).

If you have a firewall on your computer, verify that it allows inbound and outbound traffic from your computer on port 22 (for Linux instances) or port 3389 (for Windows instances).

Check the CPU load on your instance; the server may be overloaded. AWS automatically provides data such as Amazon CloudWatch metrics and instance status, which you can use to see how much CPU load is on your instance

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.