AWS - VPC with Public/Private Subnet and NAT instance

Outbound traffic from private subnet to internet

Posted by Kaushik Raj on February 1, 2016

I recently created a VPC with 2 public and 2 private subnets with a NAT instance and spent considerable time on getting the internet work from the private subnet.

The VPC configuration for my project is looks very similar to the one described here.

Even after getting all the configuration done (Elastic IP for NAT instance, Security Groups, and Disabling Source/Destination Check), the outbound traffic to the internet (from private subnet) didn't work till I found this blogpost -

The command that did the trick was executing the following on the NAT instance

iptables -t nat -A POSTROUTING -o eth0 -s -j MASQUERADE