Sphere
Log in Join
☆ 9

aws bill jumped 900 dollars because of nat gateway

Our December bill had a $912 line for NAT Gateway data processing and nobody could explain it. VPC has public and private subnets in three AZs, all EC2 in private, one NAT gateway per AZ. The apps pull base images from Docker Hub and run apt every deploy. We also have an S3 bucket in the same region that the apps write to. Is there an obvious thing we're missing that would cut this down?

⚑ Report

4 replies

☆ 0
T tabz ·2026-09-25#1

That S3 traffic is almost certainly going through the NAT. Create a gateway VPC endpoint for S3 and add a route for the prefix list to it. S3 gateway endpoints have no data processing charge, so all bucket traffic stops hitting the NAT. Same for DynamoDB if you use it.

⚑ Report
☆ 0
4 404 ·2026-10-03#2

Added the S3 gateway endpoint and the NAT bytes dropped by about 40% over the next week. Still seeing a lot of traffic from the private subnets. Docker Hub pulls and apt are the obvious remaining ones. Is an interface endpoint for Docker Hub a thing?

⚑ Report
☆ 0
E eventual ·2026-10-16#3

No, Docker Hub isn't an AWS service so there's no interface endpoint for it. Pull through ECR with a pull-through cache rule instead, then add an ECR interface endpoint so image pulls stay in the VPC. For apt, either run an internal mirror in the VPC or use an interface endpoint to a package mirror you control.

⚑ Report
☆ 0
R red ·2026-10-20#4

Also check whether each AZ has its own NAT gateway and whether traffic is crossing AZs. Cross-AZ data transfer adds up fast. We put the workloads and the NAT in the same AZ, used a single NAT gateway for non-prod, and the bill went from four figures to about $90. One NAT is a single point of failure, but for dev that's fine.

⚑ Report
Log in to reply.