Ssh – unable to ssh to ec2 inside vpc’s public subnet

amazon ec2amazon-elbamazon-web-servicesssh

My load balanced, auto scaling Elastic Beanstalk environment uses a VPC with public and private subnets in two AZs.

  • The ELB and EC2s are in the same public subnets.

  • The EC2s have been given a public IP.

  • The EC2s are in a security group with an inbound rule opening port 22 to 0.0.0.0/0 (I've also tried with my IP)

  • The EC2s are associated with the key pair I'm using (it's working for other EC2s outside this VPC).

  • The EC2s are healthy.

But…

ssh -i "~/.ssh/my.pem" ec2-user@ec2-my-instance-ip.eu-west-1.compute.amazonaws.com

… results in "Operation timed out".

What obvious thing am I missing?


Edit: Inbound rules on the public subnet's ACL:

enter image description here

Inbound rules on EC2's SG:

enter image description here

Public subnet details:

Subnet ID: subnet-3cf38775 | Public subnet 2
Availability Zone: eu-west-1b
IPv4 CIDR: 10.0.2.0/24

Route Table:
10.0.0.0/16 -> local
0.0.0.0/0 -> nat-01b4b81a02e336d3c

Best Answer

Does the subnet that instance is in have a route to 0.0.0.0/0 to the internet gateway attached to the VPC?

Also does the security group have 0.0.0.0/0 all or just tcp on the egress?