NAT gateway
AWS NAT Gateway
Lets resources in private subnets call the internet without being reachable from it.
In a monolith
Server has a public IP
A single server on a public network calls the internet directly — and is directly exposed to it.
In a distributed system
Egress point for private networks
App servers and databases live in private subnets; outbound calls (payment APIs, package downloads) leave through NAT.
On AWS
AWS NAT Gateway
Managed NAT placed in a public subnet, one per AZ, charged per hour and per GB. Use VPC endpoints for S3/DynamoDB/SQS to skip NAT costs.
- NAT Gateway (one per AZ)$$Highly available inside its AZ — deploy one per AZ
- VPC endpoints$Private access to AWS services without NAT
- Reach for it when
- Compute sits in private subnets (it should) and needs to reach the internet.
- What it costs you
- Per-GB processing charges add up
- One NAT in one AZ is an AZ-level SPOF for outbound calls
- When it dies
- Outbound calls from private subnets fail — payments, emails, webhooks. Inbound traffic is unaffected.
Interview follow-ups
Why not give app servers public IPs?
Every public IP is attack surface. Private subnets + NAT allow outbound calls while nothing can connect in.