I see EC2 instances are fickle beasts in the forums, but here's my particular spin on the issue. This is my first time using AWS, and I have been following the tutorial (I think) up to the letter. However, every attempt I have tried to connect with the instance (ssh, http, ping, Java SSH client) have all failed.

Instance Status

  1. I assign a security group at launchtime with the following permissions: ssh from my ip, http and https from anywhere, and custom IMTP/Echo Request.
  2. The assigned IAM role gives full access to Kinesis and nothing else (not sure if that affects anything).
  3. It is an ubuntu t2.micro.
  4. It has been running for the past hour.
  5. The system log's latest line is '[ip-address] login: '.

Attempts thus far:

  1. A basic ssh, copied from the "connect" window and run in the same folder as my pem. Fails with a "Connection refused" error.
  2. Telnet. Also fails with a "Connection refused" error.
  3. Ping. Request times out.
  4. Java SSH client (run in Firefox). The 'Launch' button does nothing.
  5. Create an identical instance but with a new .pem file (in case there's something wrong with my original one). Doesn't fix anything.

I am suddenly, frustratingly, despairingly stuck. Any thoughts for what else I can try? Happy to provide any other details on this thing that would be helpful; I'm just not familiar enough with AWS to know if I'm leaving out something crucial. Thanks for your help!


You must ensure the following if you want to SSH into your EC2 instance:

  1. Does your VPC have an Internet Gateway attached to it?
  2. Does the VPC's main routing table have a way out to the internet[] via the Internet Gateway in Question 1 above?
  3. Does your EC2 instance have a public IP address?
  4. You say you have allowed inbound for SSH on Port 22 and restricted it to your IP address. Does your computer carry a static IP address? If not, you may want to either allow SSH to or consider using OpenVPN to securely connect to your EC2 instance
| improve this answer | |

So a few things.

1) Make sure your security group has an egress rule allowing all to

2) It could be your routing tables are messed up. Anything with a public IP routes via the internet gateway. So check your subnet's routing table where the instance is deployed into.

| improve this answer | |

Thanks to both of you for the help! I'm going to mark Abishay's answer as correct because it pinpointed me to the right solution. Ultimately what happened is I realized that my computer had additional security settings, which were blocking me from sshing to the EC2. When I switched to a different computer with fewer restrictions, I was able to ssh to the EC2 with no issue.

TLDR: it was not my EC2 blocking incoming connections, but my computer blocking outgoing connections that was the issue.

| improve this answer | |
  • Thanks @PuttyPo. Please mark the answer as Accepted so anyone facing a similar situation in the future could use the steps mentioned in the answer. – Abishay Rao May 15 '18 at 11:03
  • @AbishayRao my bad. Done. – PuttyPo May 16 '18 at 18:45

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.