INFRASTRUCTURE LEARNINGINFRASTRUCTURE LEARNING
インフラ大全インフラ大全IT INFRASTRUCTURE / LEARNING
Infrastructure learning guide
Find a lesson or lab/

Esc to close · Search terms stay on your device

LEARNING日本語

Topic lessonTopic: VPC: address and connectivity design

NAT gateway architecture and costs: placement, processing and transfer

A NAT gateway translates the source addresses of connections initiated inside a VPC. It can support outbound access from private subnets; it is not an entry point for unsolicited inbound connections. Start with the architecture, then distinguish zonal/regional availability, public/private connectivity and the separate cost drivers.

What you will learn

Explain a suitable NAT type and routing design, then compare AZ-specific hours, bidirectional processing, transfers and public IPv4 costs.

Prerequisite

Know subnets, AZs, route tables and internet gateways (IGWs). The main examples use IPv4 egress, with IPv6 distinctions. No fixed monetary rates or live AWS operations are used.

Translation supports an outbound request and its reply

When an application in a private subnet requests an external API, the NAT gateway translates its source IPv4. With public NAT and an IGW in the same VPC, the internet-facing source is the NAT gateway’s associated Elastic IP. Replies are translated back for that connection. External users cannot use that Elastic IP to initiate arbitrary new connections to internal applications.

Example IPv4 request path through zonal public NAT; this does not depict regional placement
Example IPv4 request path through zonal public NAT; this does not depict regional placement1: Application — An appropriate application-subnet route selects NAT; traffic permission remains a separate check. — Zonal public NAT. 2: Zonal public NAT — The translated private IPv4 passes to the IGW, which maps it to the Elastic IP. — Internet gateway. 3: Internet gateway — The outbound request reaches the destination; its reply is translated back to the initiating resource. — External API123ApplicationZonal public NATInternet gatewayExternal APIExample IPv4 request path through zonal public NAT; this does not depict regional placement1: Application — An appropriate application-subnet route selects NAT; traffic permission remains a separate check. — Zonal public NAT. 2: Zonal public NAT — The translated private IPv4 passes to the IGW, which maps it to the Elastic IP. — Internet gateway. 3: Internet gateway — The outbound request reaches the destination; its reply is translated back to the initiating resource. — External API123ApplicationZonal publicNATInternetgatewayExternal API
  1. Application → Zonal public NATAn appropriate application-subnet route selects NAT; traffic permission remains a separate check.
  2. Zonal public NAT → Internet gatewayThe translated private IPv4 passes to the IGW, which maps it to the Elastic IP.
  3. Internet gateway → External APIThe outbound request reaches the destination; its reply is translated back to the initiating resource.
Application
Private subnet: route the intended external destinations to NAT.
Zonal public NAT
A NAT in a public subnet, with an associated Elastic IP.
Internet gateway
The NAT subnet routes to the IGW attached to the same VPC.
External API
The intended internet destination.

Two separate choices: connectivity and AZ availability

Public/private connectivity differs from zonal/regional availability
DimensionChoiceConditions to review
ConnectivityPublic NATCan reach the internet with an IGW; Elastic IP use depends on the path
ConnectivityPrivate NATFor destinations such as connected VPCs or corporate networks; no Elastic IP and no internet access through an IGW
Availability modeZonalLocated in one AZ; account for paths that depend on that AZ
Availability modeRegionalOne NAT ID can serve workloads across AZs; private NAT is not supported

Regional NAT does not require a public subnet to host the gateway. It is associated with a VPC and has its own route table. Automatic mode expands/contracts with workload presence; manual mode leaves IP and AZ expansion management to you. Do not apply the zonal “place NAT in a public subnet” rule to regional mode.

Zonal placement: shared versus per-AZ gateways

Applications in AZ-A and AZ-B: compare availability as well as cost
PlacementHourly billing unitsRouting, failure and transfer considerations
Share one zonal NAT in AZ-AOne available NAT gatewayAZ-B crosses to A; an outage in A can disrupt B’s outbound path too
A zonal NAT in each AZTwo available NAT gatewaysRoute each application subnet to same-AZ NAT; hourly units increase
Regional NAT configured in two AZsHours configured in both AZsOne NAT ID does not mean one AZ-hour; also review paths during expansion

Choose an option to see the result and explanation.

One regional NAT ID is configured in two AZs for ten hours each. How should you count hourly usage?
Read the answer and reason

Answer: Sum the AZ-specific hours: twenty NAT gateway-hours · Regional hourly billing is per configured AZ. In this synthetic example, 2 × 10 = 20. Actual billing also depends on partial-hour rounding and changes to the AZ footprint.

Separate gateway hours, processed data and other charges

Obtain current regional rates; no fixed monetary prices are assumed here
ComponentQuantity to inventoryCommon omission
Gateway hoursAvailable zonal gateway-hours, or configured regional hours per AZStopping EC2 does not automatically remove NAT billing
NAT data processingBillable GB processed for requests, replies and other trafficCounting only the outbound file size
Data transferApplicable AZ, Region and internet paths and directionsAssuming NAT processing includes every transfer charge
Public IPv4 and related resourcesAddresses used by public NAT and other componentsQuoting only the NAT gateway rate
Alternative pathsInterface endpoint AZ-hours, processing and other applicable itemsAssuming every NAT alternative is free
A planning worksheet; verify rates, rounding and scope before inserting prices
NAT cost = sum(billed gateway/AZ hours × matching hourly rate)
         + billed processed GB × applicable processing rate
Related costs = applicable data transfer + public IPv4 + other resources
Compared total = NAT cost + related costs

Suppose a synthetic billing plan records 100 GB processed outbound and 40 GB in replies. If both are billable processing quantities, use 140 GB. This is not a measurement and does not equate payload file size with metered usage. Destination and AZ placement can create separate transfer items.

Choose an option to see the result and explanation.

EC2 is stopped but its NAT gateway remains available. Does no traffic guarantee zero NAT charges?
Read the answer and reason

Answer: No: hourly and related charges may remain · NAT hours and processed data are separate components. Review dependencies and authorization before deletion; stopping an exercise instance alone does not complete cleanup.

Choose alternatives by destination, not by slogans

For supported same-Region S3 or DynamoDB traffic, a gateway endpoint can provide a path that avoids NAT, without additional gateway-endpoint hourly or processing fees. An interface endpoint uses service-specific network interfaces and brings its own AZ-hour and processing considerations. It does not provide arbitrary access to unrelated external APIs.

An egress-only internet gateway is a different option for outbound-only access to IPv6 internet destinations. NAT64 with DNS64 connects IPv6 workloads to IPv4 destinations and is a separate design. Compare destination address families, DNS, service support, routes and controls before changing approaches.

  1. Inventory destinations and address families, separating traffic that needs NAT from traffic suitable for endpoints or other paths.
  2. Record public/private, zonal/regional and automatic/manual choices. Inspect workload/NAT AZs, actual routes and failure scope.
  3. Estimate AZ-hours, bidirectional processed GB, transfer and public IPv4 for the same period. Record rate Region, unit and check date.
  4. Before a change, review connection resets, dependencies, migration and recovery. Do not consolidate failure scope solely to reduce hourly units.
  5. Check dependencies and authority before deleting unused resources. This lesson creates, modifies and deletes nothing.

Check, then explain in your own words

  1. Explain application-side and NAT-side routes for zonal public NAT.
  2. Distinguish the number of regional NAT IDs from billed AZ-hours.
  3. Give three reasons the NAT gateway rate alone is not the total cost.
Check your understanding: Is consolidating NAT into one gateway always the best choice?

No. Compare mode, AZ dependencies, processed data, transfers, destinations and related charges on equal terms.

One ID is not necessarily one billing unit. Zonal consolidation changes cross-AZ traffic and failure scope; regional mode also has per-AZ hours and expansion conditions.

Sources and conditions checked

The official references used in this lesson are collected here with their scope, conditions and corresponding sections. Independent expert review and live AWS comparison have not been performed.