Search code examples
amazon-web-servicessshamazon-ec2natvpc

AWS VPC using EC2 as NAT not working


I can't connect to the internet. I

1) Setup an EC2 instance in a public subnet of my VPC and with a public IP

2) Enabled all inbound and outbound traffic for the security group (just to make sure things work and that this shouldn't be an issue).

3) Disabled destination/source checks on my public EC2 instance

4) My main route table (which is the one associated with my private subnet) routes traffic from 0.0.0.0/0 to my public EC2 instance

5) Launched an instance in my private subnet in the same VPC as my public instance (without an elastic or public ip)

6) I can successfully SSH to my public instance and run ping ietf.org

7) I can successfully SSH to my private instance from my public instance, BUT ping ietf.org times out

What else should I be doing?


Solution

  • I made a mistake when setting up my EC2 instance. I was meant to set it up from an AMI of a machine with nat specific configurations on it. Otherwise I'd have to install them myselves.

    An AMI type for this is amzn-ami-vpc-nat , I overlooked this line in the documentation

    In hindsight I would just use the NAT gateway service AWS provides now. However it could be more expensive in the long run so compare the VPC pricing and the EC2 instance pricing