Sub topic 5
Why NAT gateways inflate the bill
This chapter assumes you know VPC subnets, route tables, and the difference between public and private subnets. It also assumes you can read a Cost Explorer report. The goal is to explain why NAT gateway charges grow faster than most teams expect, and how to confirm the cause in your own account.
What a NAT gateway is and what it bills
A NAT gateway is a managed network address translation service. Instances in a private subnet send internet-bound traffic to it, and it forwards that traffic through an internet gateway using its own public Elastic IP address. Replies return the same way.
AWS bills a NAT gateway in two separate parts, and each part adds to the bill even when the other is small.
| Charge | Usage type suffix | us-east-1 rate (check your region) | What triggers it |
|---|---|---|---|
| Hourly charge | `NatGateway-Hours` | about $0.045 per hour | Every hour the gateway exists |
| Data processing | `NatGateway-Bytes` | about $0.045 per GB | Every GB that passes through, in either direction |
The processing charge is the one that surprises people. It applies to the bytes processed, regardless of the destination. It applies to a download from S3 in the same region just as it does to a download from a website on the other side of the world.
The processing charge is also separate from normal data transfer charges. Traffic that leaves AWS through the NAT gateway pays both the processing fee and the usual internet egress rate.
A worked example
Suppose a fleet of private instances downloads 10,000 GB (about 10 TB) per month from S3 in the same region, through one NAT gateway.
- Data processing: 10,000 GB × $0.045 = $450.
- Hourly charge: 730 hours × $0.045 = about $33.
- S3 data transfer: $0, because same-region S3 to EC2 transfer is free.
The bill shows roughly $483 for traffic that would have cost nothing on another path. With a gateway endpoint for S3, the processing charge disappears for this traffic. The next chapter covers that fix.
Now suppose the same fleet also uploads 2,000 GB per month to a third-party API on the internet. That traffic pays the NAT processing fee (2,000 × $0.045 = $90) plus internet egress (roughly 2,000 × $0.09 = $180). The NAT fee is an addition to egress and does not replace it.
Why the bill grows without anyone noticing
Several properties of NAT gateways make cost growth easy to miss.
- Everything looks like internet traffic. An instance does not know that
s3.us-east-1.amazonaws.comis an AWS service. If the route table sends0.0.0.0/0to a NAT gateway, S3, DynamoDB, ECR, CloudWatch, and STS calls all go through it. - Both directions count. A container pulling a 1 GB image sends a few kilobytes out and receives 1 GB back. The response bytes are processed, so the full gigabyte is billed.
- Automation multiplies volume. Autoscaling groups, CI runners, and Kubernetes nodes pull images, packages, and artifacts on every launch. One extra node pool can add terabytes a month.
- Charges are spread across many resources. The NAT gateway belongs to the network team, but the traffic comes from application teams. Nobody sees the link between a deployment and the charge.
- No built-in cap. A retry loop or a misconfigured log shipper can push traffic through the gateway at full speed until someone notices.
Common sources of NAT traffic
These sources show up most often when teams investigate a NAT bill.
- S3 and DynamoDB access. Large reads, backups, data lake jobs, and log uploads. Both services support gateway endpoints, so this traffic can avoid NAT entirely.
- Container image pulls. ECR stores layers in S3 and serves them through its own endpoints, so a cluster in private subnets pulls every image layer through NAT unless endpoints exist.
- Package and OS updates.
yum,apt,pip, andnpmpulls from public mirrors on each instance launch. - Monitoring and logging agents. CloudWatch Logs, CloudWatch metrics, and X-Ray calls from every instance. These need interface endpoints to avoid NAT.
- Third-party SaaS calls. Payment, analytics, and observability vendors. These are real internet traffic and cannot use endpoints, but they still pay the processing fee.
- Cross-account AWS service calls. STS, KMS, and Secrets Manager requests are small, but high request rates add up.
The inter-AZ trap
A NAT gateway lives in one Availability Zone. If an instance in us-east-1a uses a NAT gateway in us-east-1b, every byte crosses an AZ boundary on its way to the gateway and again on the way back. AWS charges roughly $0.01 per GB in each direction for that crossing, on top of the NAT processing fee.
This happens when a team creates one NAT gateway to save the hourly cost and points every private subnet's route table at it. The saving on hourly fees (about $33 per gateway per month) can be smaller than the inter-AZ charge on a busy workload.
The common design is one NAT gateway per AZ, with each AZ's private route table pointing at its local gateway. This removes the inter-AZ hop and keeps working if another AZ fails. It costs more in hourly fees, so confirm with data that the traffic volume justifies it. For low-traffic or non-production accounts, a single gateway can be the cheaper choice.
Confirming the cause in your account
Start with Cost Explorer to see how much of the bill is NAT processing, and compare it with data transfer. This command lists last month's usage types and keeps the data transfer and NAT byte lines.
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY \
--metrics UnblendedCost \
--group-by Type=DIMENSION,Key=USAGE_TYPE \
--query "ResultsByTime[].Groups[?contains(Keys[0], 'DataTransfer') || contains(Keys[0], 'NatGateway-Bytes')].[Keys[0], Metrics.UnblendedCost.Amount]" \
--output textLook for usage types ending in NatGateway-Bytes, often with a region prefix such as USE1-. If a DataTransfer-Regional-Bytes line is also large, you are probably paying for inter-AZ traffic as well.
Next, find out which gateway carries the traffic. CloudWatch publishes NAT gateway metrics in the AWS/NATGateway namespace. BytesInFromSource is traffic arriving from your instances, and BytesInFromDestination is traffic returning from the internet. Their sum approximates the bytes you are billed for.
aws cloudwatch get-metric-statistics \
--namespace AWS/NATGateway \
--metric-name BytesInFromDestination \
--dimensions Name=NatGatewayId,Value=nat-0123456789abcdef0 \
--start-time 2026-11-01T00:00:00Z \
--end-time 2026-11-26T00:00:00Z \
--period 86400 \
--statistics Sum \
--query "sort_by(Datapoints,&Timestamp)[].[Timestamp,Sum]" \
--output textA daily series helps you tie a jump to a deployment or a new job. Replace the NAT gateway ID with your own.
Finally, find the instances responsible. With VPC Flow Logs delivered to CloudWatch Logs on the private subnets, this Logs Insights query returns the ten address pairs moving the most bytes.
stats sum(bytes) as bytesTransferred by srcAddr, dstAddr
| sort bytesTransferred desc
| limit 10If you log the NAT gateway's network interface instead, the instance addresses appear in the pkt-srcaddr and pkt-dstaddr fields, which are only available in a custom log format. The default format shows the gateway's own address.
Edge cases and common mistakes
- Deleting the wrong thing. Removing a NAT gateway stops the hourly charge, but the Elastic IP it used keeps billing if you leave it unattached. Release it.
- Assuming a public subnet avoids NAT. Instances with public IPs route through the internet gateway directly and pay no NAT fee, but they pay normal egress and gain a public attack surface. This is a security decision, not only a cost one.
- Forgetting that endpoints are per route table. A gateway endpoint only affects the route tables you attach it to. A private subnet that uses a different route table keeps sending S3 traffic to NAT.
- Counting only egress. Teams who compare "data transfer out" against the bill miss the NAT processing line, because it appears under a different usage type.
- Ignoring idle gateways. A forgotten gateway in a test VPC still costs about $33 a month.
Summary of cost drivers
| Driver | Why it costs money | First thing to check |
|---|---|---|
| AWS service traffic through NAT | Processing fee applies even though the destination is AWS | Route tables and endpoint coverage |
| Cross-AZ gateway use | Inter-AZ fee added to processing fee | Which AZ each subnet's route points to |
| Image and package pulls | Large, repeated downloads at launch | Registry and mirror locations |
| Unused gateways | Hourly fee with no traffic | `BytesInFromSource` over 30 days |
Exercise
A private instance in us-east-1a downloads 5,000 GB per month from S3 in us-east-1 through a NAT gateway in us-east-1b. Using $0.045 per GB for NAT processing and $0.01 per GB for each inter-AZ direction, estimate the monthly charges for the traffic only (ignore hourly fees). Which single change removes most of the cost?
Show answer
NAT processing is 5,000 × $0.045 = $225. The response bytes cross from AZ b to AZ a, and the inter-AZ charge applies to that crossing, about 5,000 × $0.01 = $50 on each side of the crossing, so roughly $50 to $100 depending on how the charge is counted. S3 same-region transfer itself is free. The total is roughly $275 to $325 per month. Adding an S3 gateway endpoint to the instance's route table sends the traffic straight to S3 and removes both the NAT processing and the inter-AZ hop, so almost the whole amount disappears.