Sub topic 12
Reducing data transfer costs
This chapter assumes you know the basics of AWS networking (VPCs, subnets, availability zones, NAT gateways) and can read the cost data from the earlier visibility chapters. Compute and storage prices are easy to see on a price list. Data transfer charges are harder to spot because they come from how your architecture moves bytes, not from a resource you can point at.
How data transfer is billed
AWS generally charges by direction and by distance:
| Traffic path | Typical charge |
|---|---|
| Internet into AWS | Free |
| AWS out to the internet | Charged per GB, after a small free tier |
| Between regions | Charged per GB |
| Between availability zones (AZs) in one region | Charged per GB, in each direction |
| Within one AZ over private IPs | Free |
| Through a NAT gateway | Per-GB processing fee, plus an hourly fee |
Check current rates on the AWS pricing pages, because they vary by region and change over time. The pattern holds: the farther and more public the path, the higher the cost.
Find the transfer charges first
Group your spend by usage type to see transfer costs. Usage types that contain DataTransfer or NatGateway-Bytes point at the problem.
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[0].Groups[?contains(Keys[0], `DataTransfer`) || contains(Keys[0], `NatGateway`)].{Type:Keys[0],Cost:Metrics.UnblendedCost.Amount}' \
--output tableThe query filters the grouped results on the client side. It shows only the lines that relate to transfer.
Common causes and fixes
Route AWS service traffic around the NAT gateway
A workload in a private subnet that reads S3 through a NAT gateway pays the NAT processing fee on every GB. A gateway VPC endpoint for S3 or DynamoDB has no hourly or per-GB charge, and it sends traffic over the AWS network instead.
aws ec2 create-vpc-endpoint \
--vpc-id vpc-0abc1234example \
--service-name com.amazonaws.us-east-1.s3 \
--vpc-endpoint-type Gateway \
--route-table-ids rtb-0abc1234exampleReplace the IDs and the region in the service name with your own. Interface endpoints for other services do carry hourly and per-GB fees, so compare them against your NAT volume first.
Serve users through a CDN
A content delivery network (CDN) caches content close to users. Amazon CloudFront's per-GB rates to the internet are usually lower than serving the same bytes directly from EC2 or S3. Transfer from an AWS origin to CloudFront is free. Caching also reduces how often the origin sends data at all. Turn on compression so each response is smaller.
Reduce cross-AZ and cross-region traffic
- Place tightly coupled services in the same AZ when your availability needs allow it.
- Use zone-aware routing features, such as topology-aware routing in Kubernetes, so requests prefer a local replica.
- Replicate across regions only the data that needs it. Each replicated GB is billed once for transfer and again for storage.
Trade-offs
Same-AZ placement lowers the transfer bill but reduces fault tolerance. Weigh the saving against the cost of an outage for that workload before you change a design that exists for resilience.
Exercise
A private-subnet application reads 20 TB a month from S3 through a NAT gateway. What is the lowest-cost change, and why?
Show answer
Add an S3 gateway VPC endpoint and update the route table. Traffic to S3 then bypasses the NAT gateway, so the per-GB NAT processing fee no longer applies. The gateway endpoint itself has no hourly or per-GB charge.