Access Internet from Private Subnet in VPC

AWS
Network
How to setup AWS VPC so we can access internet from the private subnet.
Author

Ziyue Li

Published

November 23, 2022

I’m finally forced to learn the network configuration stuff in AWS VPC. The thing that was confusing me was the NAT Gateway.

For a private subnet to access the internet, we route traffic from the private subnet through a NAT Gateway which keeps out all traffic initiated from the internet. This gateway needs to be in a public subnet, so that it can access the internet through the Internet Gateway.

To route the traffic in this way, we need to make sure there’s an entry in the route table for the public subnet to connect to the Internet Gateway, and there’s an entry in the route table for the private subnet to connect to the NAT Gateway.