AWS Builder Center
The NAT Gateway Trap: How Free VPC Endpoints Can Slash Your AWS Bill

The NAT Gateway Trap: How Free VPC Endpoints Can Slash Your AWS Bill

Discover why routing Amazon S3 and DynamoDB traffic through your NAT Gateway silently inflates your cloud bill, and how configuring free Gateway VPC Endpoints takes two minutes and slashes data transfer costs immediately.

If you open your AWS Cost Explorer at the end of the month and notice a disproportionately large bill under Virtual Private Cloud (VPC), you are not alone.
For thousands of engineering teams, the culprit is almost always the same quiet budget-eater: The NAT Gateway.
While NAT Gateways are essential for allowing instances in private subnets to access the public internet safely, many architectures unknowingly route high-volume internal AWS traffic through them.
In this guide, we will uncover how the NAT Gateway pricing trap works and how a simple, 100% free AWS feature can eliminate hundreds (or thousands) of dollars from your monthly bill in less than two minutes.



1. The Math Behind the NAT Gateway Trap

To understand why your bill spikes, let’s review standard NAT Gateway pricing (using  us-east-1  as an example):
  1. Hourly Fee: $0.045 per hour per NAT Gateway ($32.40/month just for existing).
  1. Data Processing Fee: $0.045 per GB of data transferred through the gateway.
The hourly fee is predictable, but the data processing fee is where bills spiral out of control.
Imagine you have background workers (EC2 instances, ECS tasks, or Lambdas inside a VPC) running in private subnets. Every day, these workers read and write application assets, backups, or machine learning datasets to Amazon S3 or query Amazon DynamoDB.
If your application processes 10 TB of S3 data per month through your NAT Gateway: $$\text{10,000 GB} \times $0.045 = \mathbf{$450\text{ USD/month}}$$
You are paying nearly half a thousand dollars just for your data to cross a network boundary—even though both your servers and your S3 buckets live inside the exact same AWS data center!



2. Why Does This Happen?

Amazon S3 and DynamoDB are public AWS services. They have public IP addresses that live outside your private VPC.
By default, when an instance in a private subnet wants to talk to S3, its route table has a single default exit route:
Destination: 0.0.0.0/0 --> Target: nat-0123456789abcdef (NAT Gateway)
Your private traffic is forced through the NAT Gateway, out to the public internet backbone, and back into S3. You are paying NAT Gateway processing fees for traffic that never needed to leave AWS in the first place.
[ Private EC2 / ECS ]
│
▼ (Costs $0.045 / GB)
[ NAT Gateway ] ──► [ Public Internet Backbone ] ──► [ Amazon S3 ]



3. The Hero: Gateway VPC Endpoints (Completely Free!)

AWS provides a native, zero-cost solution designed specifically for this problem: Gateway VPC Endpoints.
A Gateway Endpoint acts as a private, direct shortcut inside AWS’s software-defined network. It routes traffic destined for S3 or DynamoDB directly across the internal AWS backbone.
[ Private EC2 / ECS ]
│
▼ (FREE: $0.00 / GB)
[ Gateway VPC Endpoint ] ──────────────────────────► [ Amazon S3 ]

Key Benefits:

  • Cost: $0.00/hour and $0.00/GB. There are literally no hourly fees or data processing charges for Gateway Endpoints.
  • Lower Latency & Higher Throughput: Traffic travels entirely over the high-speed AWS internal network without passing through NAT bottlenecks.
  • Enhanced Security: You can attach an Endpoint Policy to restrict which S3 buckets your private instances are allowed to reach, preventing malicious data exfiltration.



4. Hands-On Setup in 4 Steps (Takes Under 2 Minutes)

You can configure this right now in the AWS Console without any downtime or server restarts:

Step 1: Open the Endpoints Console

Navigate to the VPC Console > Endpoints (under Virtual private cloud) > Click Create endpoint.

Step 2: Select the S3 or DynamoDB Service

  • Give it a name (e.g.,  s3-gateway-endpoint ).
  • Under Service category, select AWS services.
  • In the search bar, type  s3  (or  dynamodb ).
  • Look for the service named  com.amazonaws.<region>.s3  and make sure the Type column says Gateway (not Interface).

Step 3: Attach to Your Route Tables

  • Select your target VPC.
  • A list of your VPC’s route tables will appear. Check the boxes next to your Private Route Tables (the ones where your backend workers or private Lambdas live).

Step 4: Policy & Creation

  • Keep the policy set to Full access (or customize it to restrict access to specific buckets).
  • Click Create endpoint.

Verification:

Open one of your private route tables. You will notice AWS automatically added a new route entry:
Destination: pl-63a5400a (S3 Prefix List) --> Target: vpce-0123456789abcdef (Your Endpoint)
Because AWS route tables prioritize the most specific route over the default  0.0.0.0/0  route, all S3 traffic will instantly bypass your NAT Gateway immediately and for free.



⚠️ Important Note: Gateway vs. Interface Endpoints

Be careful when creating VPC endpoints:
  • Gateway Endpoints: Only exist for Amazon S3 and Amazon DynamoDB. They modify route tables and are 100% FREE.
  • Interface Endpoints (AWS PrivateLink): Used for almost all other AWS services (like SQS, Secrets Manager, ECR, etc.). These deploy an elastic network interface (ENI) in your subnet and do cost ~$0.01/hour plus data processing fees.
For S3 and DynamoDB, always make sure you select the Gateway type!
Cloud cost optimization (FinOps) doesn't always require massive architectural refactors or shutting down servers. Often, it comes down to understanding how AWS networking functions under the hood.
Setting up Gateway VPC Endpoints for S3 and DynamoDB is one of the highest-ROI, lowest-risk optimizations you can make in any AWS environment.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article