Internet Gateway vs NAT Gateway: AWS VPC Traffic Flow
Overview Both are AWS VPC components that connect subnets to the internet, but they serve opposite access models. An Internet Gateway gives resources with public IPs full bidirectional internet access, while a NAT Gateway lets private resources reach outbound without ever being directly reachable from the internet. Picking the wrong one either exposes resources you meant to keep private or blocks outbound traffic a backend service needs. Comparison Diagram Internet GatewayNAT GatewayInternetInternetIGWPublic SubnetEC2 (public IP)Bidirectional traffic allowedoutboundblockedNAT GatewayoutboundblockedPrivate SubnetEC2 (private IP)Outbound-initiated only Comparison Table Aspect Internet Gateway NAT Gateway Primary purpose Routes traffic between a VPC and the public internet Lets private-subnet resources initiate outbound internet traffic Traffic direction Bidirectional (inbound and outbound) Outbound-initiated only; unsolicited inbound is dropped Subnet placement Attached to the VPC itself; referenced by public subnet route tables Deployed inside a public subnet, referenced by private subnet route tables IP translation None performed; relies on 1:1 mapping of public/Elastic IPs to instances Performs many-to-one NAT, translating many private IPs to its own Elastic IP Scaling & bandwidth Horizontally scaled, redundant, no bandwidth cap Scales automatically per AZ, bursts to tens of Gbps as a single managed appliance High availability Inherently redundant across the VPC, not AZ-scoped Zonal resource; needs one NAT Gateway per AZ for resilience Cost No charge from AWS Hourly charge plus per-GB data processing fee Failure mode Instance unreachable from outside if route or public IP missing All private instances behind it lose internet access if it fails or is misconfigured Key Differences Internet Gateway allows unsolicited inbound connections; NAT Gateway only permits traffic the private instance initiated. NAT Gateway performs address translation to a shared Elastic IP; Internet Gateway does no translation and depends on each instance already having a public IP. Internet Gateway is free and VPC-wide; NAT Gateway is a billed, zonal resource that needs per-AZ redundancy. Losing the Internet Gateway cuts off public-subnet reachability; losing a NAT Gateway cuts off all outbound access for its entire private subnet. When to Use Each Internet Gateway ...