NAT Gateway (NAT)
Outbound IPv4 translation gateway placed in a public subnet with an allocated Elastic IP, serving as the 0.0.0.0/0 default route target for private subnet route tables.
AWS Container Placement
SUBNET
Summary
Managed Network Address Translation (NAT) service that enables instances in private subnets to connect to the internet or AWS services without receiving unsolicited inbound connections.
When to Use (SAA-C03)
Deploy ONE NAT Gateway per Availability Zone in Public Subnets for HA; use S3/DynamoDB Gateway Endpoints to avoid NAT data processing fees!
Allowed Ingress Connections & Ports
| Source Service | Protocol | Port | Architectural Rationale |
|---|---|---|---|
| EC2 | TCP, UDP, ICMP | All / Ephemeral | Outbound traffic originating from private EC2 instances |
| ECS | TCP, UDP | 80, 443, 53 | Container task outbound API calls, package pulls, and external integrations |
| LAMBDA | TCP, HTTPS | 443 | VPC-enabled Lambda functions accessing external SaaS endpoints |
| RTB | ROUTE | 0 | Private Route Table default route target (0.0.0.0/0) |
Allowed Egress Targets & Ports
| Target Service | Protocol | Port | Data Flow Rationale |
|---|---|---|---|
| IGW | TCP, UDP, ICMP | All / Ephemeral | Translated SNAT packets forwarded to Internet Gateway for public internet egress |
Key Configuration Parameters & AWS Best Practices
| Parameter | Format / Example | Purpose & Rationale |
|---|---|---|
| Subnet ID (subnetId) (Required) | subnet-0a1b2c3d4e5f67890 (Public Subnet A) | The public subnet in which to provision the NAT Gateway elastic network interface (ENI). Why: NAT Gateway must reside in a public subnet having an active 0.0.0.0/0 route pointing to an Internet Gateway. |
| Elastic IP Allocation ID (allocationId) (Required) | eipalloc-0123456789abcdef0 | The allocation ID of an existing Amazon VPC Elastic IP address to associate with the public NAT Gateway. Why: Public NAT Gateways require a static public IPv4 address to perform source network address translation (SNAT) for internet-bound packets. |
| Connectivity Type (connectivityType) (Required) | public | Specifies whether the NAT Gateway connects to the internet (public) or communicates privately between VPCs/on-premises (private). Why: Public NAT Gateways require an Elastic IP and Internet Gateway; private NAT Gateways perform address translation between overlapping private IP ranges without an EIP. |
| Secondary Elastic IP Allocation IDs (secondaryAllocationIds) | ["eipalloc-02468ace...", "eipalloc-13579bdf..."] | Additional Elastic IP addresses assigned to the NAT Gateway to scale outbound concurrent connections. Why: Mitigates TCP source port exhaustion when private workloads establish more than 55,000 concurrent connections to a single destination IP. |
| Private IPv4 Address (privateIp) | 10.0.1.250 | Explicit private IP address within the subnet range to assign to the primary ENI. Why: Ensures deterministic static private addressing for auditing or firewall rule enforcement. |
| Tags | Tier: Networking, Environment: Production | Resource tags for FinOps tracking, owner attribution, and automation. Why: Enables precise tracking of NAT Gateway operational and data transfer costs in AWS Cost Explorer. |
Practice Labs Using NAT Gateway
HealthTech EMR Backend: Asymmetric Outbound NAT Routing
Re-point the private route table default route pointing to NAT (0.0.0.0/0 -> nat-xxx) in the public subnet.…
SAA-08Multi-Tier Highly Available Web Architecture: Dual-AZ ALB, ASG Fleet & Multi-AZ RDS
Re-architect for multi-AZ high availability: map the public ALB across dual AZs (us-east-1a and us-east-1b), d…
SAA-10Non-Prod Fleet: Multi-AZ NAT & On-Demand Compute Overspend
Consolidate staging egress to a single NAT Gateway, update private route tables to route through the single NA…
SAA-C03-FINOPS-NAT-HAIRPINNINGFinOps Optimization: Eliminating NAT Gateway Hairpinning & Cross-AZ Tax
Provision an S3 Gateway Endpoint in the VPC and route private EC2 backup traffic directly to S3 without traver…
SAP-05Centralized Egress Inspection: TGW Default Route Blackhole
Add the default route 0.0.0.0/0 in the Transit Gateway route table pointing to the Central Egress VPC.…
SAP-09Enterprise Transit Hub: Centralized Egress Asymmetric Return Route Blackhole
Add a route for 10.10.0.0/16 targeting vpc-spoke-a in the Inspection TGW route table.…
Frequently Asked Questions
Where does NAT Gateway live inside an AWS VPC architecture?
Valid container placement: SUBNET. Outbound IPv4 translation gateway placed in a public subnet with an allocated Elastic IP, serving as the 0.0.0.0/0 default route target for private subnet route tables.
When should I use NAT Gateway on the AWS SAA-C03 exam?
Deploy ONE NAT Gateway per Availability Zone in Public Subnets for HA; use S3/DynamoDB Gateway Endpoints to avoid NAT data processing fees!
Can I simulate NAT Gateway packet routing without an AWS account?
Yes. CloudTracer simulates NAT Gateway along with 53 AWS services directly in your browser and exports production Terraform HCL.