4

I have a new ubuntu EC2 micro instance in a VPN with what i think should be access from the outside world to ssh.

$ ssh -i ./sendy.pem ubuntu@52.5.229.252

ssh: connect to host 52.5.229.252 port 22: Operation timed out

One thing that looks wrong to me is the elastic ip address. It doesn't have a "Public DNS", but I don't see a way to change that.

Elastic IP   | Instance           | Private IP Address | Scope        | Public DNS
52.5.229.252 | i-47260e68 (Sendy) | 10.91.1.51         | vpc-16e2c673 |

I'm stuck, and not sure what to do.



EC2 Instance

Some fields that seem important (happy to provide more):

  • Instance ID - i-47260e68
  • AMI ID - ubuntu-trusty-14.04-amd64-server-20150325 (ami-d05e75b8)
  • Public IP - 52.5.229.252
  • VPC ID - vpc-16e2c673
  • Instance state - running
  • Key pair name - sendy

Private Key

$ cat sendy.pem | head -n 1

-----BEGIN RSA PRIVATE KEY-----

Security Group

Name         | Group ID    | Group Name   | VPC ID       | Description
sendy-server | sg-6feea80b | sendy-server | vpc-16e2c673 | Sendy Web Server

Inbound rules include:

Type | Protocol | Port Range | Source
SSH  | TCP      | 22         | 0.0.0.0/0

Happy to provide more.

AJcodez
  • 233
  • 1
  • 4
  • 11

1 Answers1

8

Three possibilities:

  1. Your VPC route table for the subnet is missing an entry pointing 0.0.0.0/0 to the IGW
  2. Your instance was launched into the default or wrong security group that is missing the incoming ssh rule
  3. You have a NACL on the subnet that is blocking the traffic
Chad Smith
  • 1,489
  • 8
  • 8
  • And to fix the missing DNS issue, go into the VPC dashboard in the AWS console, select your VPC, then Actions->DNS Hostnames, and select YES – Chad Smith Apr 21 '15 at 21:04
  • This is pretty random and an edge case, but for me the issue was I was trying to connect over a phone hotspot, which meant a different public ipv4 than what was showing in the browser. Doesn't mean this answer is incorrect, just is something to watch out for when determining your ip. Even selecting the ip that amazon offers as "My Ip" when you're whitelisting ips in the security group will be wrong if on a hotspot. – RyanQuey Sep 11 '20 at 21:43
  • It can also be that you forgot to use your private key when defining the new session. – Eyal Golan Nov 25 '22 at 14:02