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

AspectInternet GatewayNAT Gateway
Primary purposeRoutes traffic between a VPC and the public internetLets private-subnet resources initiate outbound internet traffic
Traffic directionBidirectional (inbound and outbound)Outbound-initiated only; unsolicited inbound is dropped
Subnet placementAttached to the VPC itself; referenced by public subnet route tablesDeployed inside a public subnet, referenced by private subnet route tables
IP translationNone performed; relies on 1:1 mapping of public/Elastic IPs to instancesPerforms many-to-one NAT, translating many private IPs to its own Elastic IP
Scaling & bandwidthHorizontally scaled, redundant, no bandwidth capScales automatically per AZ, bursts to tens of Gbps as a single managed appliance
High availabilityInherently redundant across the VPC, not AZ-scopedZonal resource; needs one NAT Gateway per AZ for resilience
CostNo charge from AWSHourly charge plus per-GB data processing fee
Failure modeInstance unreachable from outside if route or public IP missingAll 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

  • Public web/app servers: Instances that must accept inbound requests directly from users need an Internet Gateway route and a public IP.
  • Bastion hosts: A jump box needs inbound SSH/RDP from the internet, which only an Internet Gateway permits.
  • Load balancer front ends: Internet-facing ALBs/NLBs sit in public subnets routed through an Internet Gateway to receive client traffic.

NAT Gateway

  • Private app/database tier: Backend servers that need OS patches or API calls out but must never accept inbound internet connections.
  • Compliance-restricted workloads: Workloads required to have no direct inbound internet path still need outbound connectivity for updates or telemetry.
  • Multi-tier architectures: Private subnets behind a public-facing tier use a NAT Gateway so only the front end is directly internet-reachable.