CN
CloudNetworking.io AWS Analytics, BI, Search, Networking & Architecture Guides
AWS Networking + Private Subnet Outbound Access

AWS NAT Gateway explained in practical cloud networking terms

AWS NAT Gateway is the managed service that allows resources in private subnets to initiate outbound connectivity without making those resources directly reachable from the internet. It is one of the key building blocks behind secure AWS application architectures.

This page goes beyond the basic definition. It explains where NAT Gateway sits in a VPC, how route tables and Internet Gateway work with it, why NAT Gateway placement matters, when one NAT Gateway per Availability Zone is the safer design, and where teams often make design or troubleshooting mistakes.

Private subnets stay private Resources can go out for updates, APIs, and package downloads without becoming inbound internet targets.
Route-table driven behavior NAT Gateway only works properly when the subnet route design and Internet Gateway relationship are correct.
AZ-specific design matters Each NAT Gateway lives in one Availability Zone, so high-availability routing decisions matter more than many teams expect.
Managed alternative to NAT instances It reduces operational burden compared with self-managed NAT instance designs in many common architectures.

At a glance

A quick summary before the deeper sections on route flow, resiliency, Terraform, and real-world NAT Gateway design.

Placement A public NAT Gateway is created in a public subnet and depends on correct internet-facing routing.
Main purpose Allow outbound connectivity for private subnet resources while blocking unsolicited inbound internet initiation.
Private subnets Private subnets typically use a default route pointing to a NAT Gateway rather than directly to an Internet Gateway.
Resiliency For multi-AZ workloads, creating one NAT Gateway per Availability Zone is the more resilient pattern.
A good first video for understanding why NAT Gateway exists in private subnet designs and how outbound-only internet access works.
01

NAT Gateway is about outbound access

Its job is not to make private workloads public. Its job is to let them initiate external communication safely.

02

Routing defines the behavior

NAT Gateway only makes sense when private subnet route tables send internet-bound traffic to it correctly.

03

Availability Zone design is important

A single NAT Gateway for multi-AZ workloads may look simpler, but it can create resiliency problems.

04

Managed does not mean “design-free”

You still need correct subnet placement, Elastic IP handling, route logic, and operational awareness.

What is AWS NAT Gateway

What is an AWS NAT Gateway?

A NAT Gateway is the AWS managed Network Address Translation service used to give private subnet resources outbound connectivity to destinations outside the subnet’s private address space. In the common internet-access scenario, this means private subnet resources can reach the internet without being directly reachable from it.

In practical terms, NAT Gateway exists because many workloads should stay inside private subnets. Application servers, worker nodes, internal APIs, background jobs, and private compute often need to install updates, pull packages, call third-party APIs, or reach public endpoints. At the same time, those workloads should not be exposed to direct unsolicited inbound internet traffic.

NAT Gateway solves that by acting as a controlled outbound path. It is part of a broader route design where:

  • The NAT Gateway is created in a public subnet
  • The public subnet has internet-facing routing through an Internet Gateway
  • Private subnets route outbound traffic to the NAT Gateway
  • Return traffic comes back through the established translation path
Private Subnet Access Outbound Internet Route Tables Elastic IP Internet Gateway Multi-AZ NAT

Simple definition

AWS NAT Gateway is the managed outbound path for private subnet resources.

What it is good at

  • Outbound internet access from private subnets
  • Reducing direct exposure of application instances
  • Simplifying NAT operations compared with self-managed NAT instances
  • Supporting common secure VPC architecture patterns

What it is not

  • It is not an inbound internet entry point
  • It is not a replacement for an Internet Gateway
  • It is not a security group or firewall
  • It is not a universal answer when VPC endpoints or private connectivity options fit better
Key idea: NAT Gateway helps private subnet resources go out. It does not make them publicly reachable.
Why it matters

Why NAT Gateway matters in AWS networking

NAT Gateway matters because secure cloud networking is rarely about making everything public. Most mature AWS environments want a clear separation between public entry points and private workloads.

Private workloads still need outbound access

Internal compute often needs package repositories, updates, external APIs, or vendor endpoints even if it should never accept direct inbound internet requests.

Security architecture becomes cleaner

Keeping app and worker tiers private reduces exposure while still supporting practical operational requirements.

Managed service reduces NAT operations

Many teams prefer a managed NAT service over maintaining EC2-based NAT instances and patching or scaling them manually.

Typical reasons NAT Gateway appears in architecture

  • Application servers download packages or OS updates
  • Private containers pull dependencies or reach external services
  • Internal jobs call payment, messaging, or SaaS APIs
  • Private compute needs outbound access without public exposure

What NAT Gateway helps prevent

  • Making private instances public just for updates
  • Overusing public subnets where private subnets are more appropriate
  • Confusing outbound internet needs with inbound access design
5 W’s + How

AWS NAT Gateway through the 5 W’s + How

What

A managed NAT service used to let private subnet resources initiate outbound connectivity.

Why

To keep workloads private while still allowing updates, package downloads, and external API access.

When

When private subnets need outbound internet access and direct inbound exposure is not desired.

Where

Created in a public subnet and used by private subnets through route-table configuration.

Who should care

  • Cloud engineers
  • DevOps engineers
  • Platform engineers
  • Security architects
  • Teams running private compute in VPCs

How it works conceptually

  • Create a public NAT Gateway in a public subnet
  • Associate the required addressing for public internet use
  • Point private subnet default routes to the NAT Gateway
  • Allow outbound traffic initiation from private resources
  • Keep unsolicited inbound internet initiation blocked
How it works

How AWS NAT Gateway works in practice

NAT Gateway works as part of a route design, not as a standalone magic box. The most common operational pattern is private subnet outbound internet access through a public NAT Gateway.

Step-by-step flow

  1. A private resource initiates outbound traffic.
  2. The private subnet route table sends default internet-bound traffic to the NAT Gateway.
  3. The NAT Gateway, which sits in a public subnet, forwards traffic outward.
  4. The public subnet’s path to the Internet Gateway supports internet egress.
  5. Response traffic returns through the NAT translation path to the originating private resource.
Important: connections must be initiated from within the VPC side. NAT Gateway is not an inbound public entry point.

What must exist for a common public NAT design

  • A public subnet for the NAT Gateway
  • Correct internet-facing routing for that public subnet
  • Private subnet route tables with a default route to the NAT Gateway
  • Correct subnet associations
  • Thoughtful multi-AZ design when workloads span multiple Availability Zones

What people often miss

  • The NAT Gateway itself is in a public subnet, not a private subnet
  • Private subnet behavior depends on its route table
  • “Private” does not mean “can never go out”; it means “not directly internet-reachable”
Architecture diagram

AWS NAT Gateway architecture diagram

The diagram below shows the correct common NAT Gateway pattern: an Internet Gateway attached to the VPC, NAT Gateways placed in public subnets, private subnet route tables pointing outbound traffic to NAT Gateways, and private workloads remaining non-public while still reaching the internet or external services outbound.

AWS NAT Gateway architecture diagram showing Internet Gateway, public subnets with NAT Gateways, private subnets with application and worker workloads, route tables, outbound-only internet access flow, and one NAT Gateway per Availability Zone design
This NAT Gateway layout shows the relationship between VPC, public subnets, private subnets, Internet Gateway, route tables, and Availability Zone-aware outbound internet design.
NAT Gateway Diagram Private Subnet Egress Internet Gateway Flow Route Table Design Multi-AZ NAT
Route flow

Route flow and route-table relationship

NAT Gateway behavior is inseparable from route-table design. A private subnet becomes “internet-capable outbound” through the route table, not by magic and not merely by being called private.

Typical route pattern
Public subnet route table
0.0.0.0/0  ---> Internet Gateway

Private subnet route table
0.0.0.0/0  ---> NAT Gateway

Public subnet role

The public subnet is where the NAT Gateway lives in the common design, and its route path must allow outward access toward the Internet Gateway.

Private subnet role

The private subnet sends internet-bound traffic to the NAT Gateway instead of directly to the Internet Gateway, which preserves the private architecture pattern.

Comparison section

NAT Gateway vs other networking options

NAT Gateway vs Internet Gateway

Area NAT Gateway Internet Gateway
Main role Outbound connectivity path for private resources Internet connectivity component for public internet routing
Common use Private subnets need outbound access Public subnet internet access pattern
Inbound public reachability No unsolicited inbound initiation Supports public routing patterns when architecture allows

NAT Gateway vs NAT instance

Area NAT Gateway NAT Instance
Operational model Managed AWS service Self-managed EC2-based design
Maintenance Lower operational burden More instance management responsibility
When people compare them Standard managed VPC egress design Custom or legacy NAT patterns

NAT Gateway vs VPC endpoints

Question NAT Gateway VPC Endpoints
Main fit General outbound connectivity path Private access path to specific supported AWS services
Why compare them Used for broader external reach Often reduces need to traverse public internet for supported AWS services
Architecture outcome General egress pattern Service-specific private connectivity pattern
High-availability design

High-availability and multi-AZ NAT Gateway design

NAT Gateway is Availability Zone-specific. That matters a lot in resilient architectures.

Each NAT Gateway belongs to one AZ

That means its failure domain and its routing implications are tied to that Availability Zone design.

Shared single NAT can create risk

If workloads across multiple AZs depend on one NAT Gateway and that AZ has an issue, other AZ resources can lose outbound access.

One NAT per AZ is the safer pattern

For resilient multi-AZ architectures, route each AZ’s private resources to a NAT Gateway in the same AZ.

Practical rule: if the application spans multiple Availability Zones and outbound access matters, one NAT Gateway per Availability Zone is usually the better design.
Embedded videos

AWS NAT Gateway videos

These are embedded as large videos with short bridge text so the page feels guided rather than like a plain video stack.

A good starting video for understanding the basic NAT Gateway idea and why private subnets still need controlled outbound internet access.
Once the core concept is clear, the next thing people usually struggle with is the route-flow relationship: where the NAT Gateway lives, how private subnets point to it, and how that differs from Internet Gateway-based public routing.
This fits well after the first explanation because it reinforces subnet placement and route-table thinking, which is where most AWS networking confusion starts.
After placement and routing, the next useful step is seeing NAT Gateway in a wider architecture context: real VPC patterns, private app tiers, and design choices that affect reliability and maintainability.
A strong final watch for readers who want to connect NAT Gateway into broader VPC architecture and real-world deployment patterns.
Terraform example

Terraform example for NAT Gateway basics

Below is a simple example showing the kind of Terraform resources often involved in a public NAT Gateway pattern.

Basic NAT Gateway Terraform example
resource "aws_eip" "nat_eip" {
  domain = "vpc"

  tags = {
    Name = "nat-eip-a"
  }
}

resource "aws_nat_gateway" "nat_a" {
  allocation_id = aws_eip.nat_eip.id
  subnet_id     = aws_subnet.public_a.id

  tags = {
    Name = "nat-gateway-a"
  }
}

resource "aws_route" "private_default_route" {
  route_table_id         = aws_route_table.private_a.id
  destination_cidr_block = "0.0.0.0/0"
  nat_gateway_id         = aws_nat_gateway.nat_a.id
}

What this shows

  • An address allocation for the public NAT use case
  • A NAT Gateway placed in a public subnet
  • A private route table sending default outbound traffic to the NAT Gateway

What a full design would also include

  • VPC and subnet resources
  • Internet Gateway
  • Public subnet route table
  • Optional multi-AZ duplication for resiliency
Real-world examples

Real-world NAT Gateway use cases

Application servers in private subnets

App servers can install updates, fetch packages, and call external APIs without being directly internet-exposed.

Private worker nodes

Workers, jobs, or backend compute can reach required public endpoints while remaining behind private networking boundaries.

Platform-managed private compute

Organizations often standardize NAT Gateway in shared network patterns so private workloads behave consistently across environments.

Typical three-tier example

  • Public subnets host internet-facing load balancers
  • Private app subnets host application servers
  • Private database subnets host databases
  • App subnets use NAT Gateway for outbound-only internet reach

Useful memory trick

Internet Gateway is the public front gate. NAT Gateway is the controlled outbound exit path for private internal teams that need to go out but should not let strangers come in directly.

Common mistakes

Common NAT Gateway mistakes

Placing it in the wrong subnet

A public NAT Gateway belongs in a public subnet, not a private subnet.

Missing route-table logic

Private subnet outbound traffic must actually point to the NAT Gateway, or the design will not work.

Assuming NAT allows inbound internet access

It does not. NAT Gateway is about outbound initiation for private resources.

Using one NAT for multi-AZ without thinking about resiliency

A single shared NAT may look simpler but can create Availability Zone dependency for outbound connectivity.

Ignoring alternatives

For some service-specific AWS access patterns, VPC endpoints may be the more targeted design.

Forgetting cost-aware architecture review

NAT Gateway is managed and convenient, but architecture should still be intentional, especially at scale.

Troubleshooting

AWS NAT Gateway troubleshooting guide

Troubleshooting NAT Gateway is usually about route logic, placement, subnet design, or misunderstanding what NAT Gateway does and does not do.

Issue Likely cause What to check Fix direction
Private instance cannot reach internet Route issue or placement issue Private route table, NAT placement, public subnet internet path Validate end-to-end route design
NAT exists but traffic still fails Subnet or route association mismatch Correct route table attached to the private subnet Re-check route-table association and default route
Multi-AZ app loses outbound access during AZ issue Single-NAT dependency Whether each AZ has its own NAT path Use per-AZ NAT design for better resiliency
Team expects inbound access through NAT Design misunderstanding Architecture intent and routing assumptions Use proper public entry components instead of NAT for inbound internet access

Quick check list

  • Is the NAT Gateway in the correct public subnet?
  • Does the public subnet have the required outward routing relationship?
  • Does the private subnet route default traffic to the NAT Gateway?
  • Is the private workload actually in the private subnet you think it is?

Architecture check list

  • Should this workload use NAT Gateway at all?
  • Would VPC endpoints reduce unnecessary general internet egress?
  • Should each Availability Zone have its own NAT path?
  • Are teams confusing public and private subnet behavior?
Troubleshooting principle: NAT Gateway problems are usually route and placement problems before they are anything else.
FAQ

AWS NAT Gateway FAQ

What is an AWS NAT Gateway?
A NAT Gateway is the managed AWS Network Address Translation service used to allow private subnet resources to initiate outbound connectivity without becoming directly reachable from the internet.
Does NAT Gateway go in a public subnet or private subnet?
In the common public NAT design for internet access, it is created in a public subnet and used by private subnets through route-table configuration.
Can the internet initiate direct inbound connections to private instances through NAT Gateway?
No. NAT Gateway is for outbound initiation from private resources, not unsolicited inbound internet initiation.
Why create one NAT Gateway per Availability Zone?
Because each NAT Gateway belongs to one Availability Zone. For resilient multi-AZ design, routing each AZ to its own NAT Gateway reduces cross-AZ dependency for outbound access.
Is NAT Gateway the same as Internet Gateway?
No. Internet Gateway is the VPC component used in public internet routing patterns, while NAT Gateway is the managed outbound path typically used by private subnet resources.
When should I think about VPC endpoints instead?
When your goal is private access to specific supported AWS services rather than broader general outbound connectivity patterns.