1
votes

I have a vpc with 2 private and 2 public subnets. I have added ec2 instance in a public subnet. The EC2 is given a private ip according to CIDR of VPN and public subnet.

Route table contains a row of 0.0.0.0/0 with internet gateway the public subnet is associated with this route table. EC2 is also healthy

I am unable to troubleshoot how to ssh to my instance. I am new to VPC and this is my first time working with my own so I might have missed something.

Inbound rules on sg

inbound rules on NACL

1

1 Answers

2
votes

Several things to check:

  1. Make sure the EC2 has a public IP assigned (enable auto-assign IPv4 address on the public subnet)

  2. NACL outbound rule allows your IP/ any IP to port 22/ any port since NACLs are stateless

  3. The internet gateway is attached to the correct VPC

  4. The subnet is associated with the correct route table that has internet gateway

  5. The EC2 is provisioned under the correct public subnet that is associated with the route table

  6. The SG that allows port 22 inbound is attached to the EC2