Sub topic 1
How AWS Charges for Data Transfer
Prerequisites
This chapter assumes you know AWS Regions, Availability Zones (AZs), VPCs, subnets, EC2, and S3. You should also understand basic IP routing and be able to use the AWS console or CLI.
How AWS Charges for Data Transfer
AWS pricing depends on where bytes travel and which service processes them. Common categories include internet transfer, inter-Region transfer, inter-AZ transfer, and managed network processing. Each category can have different rates, directions, and free allowances.
| Traffic path | Typical cost concern |
|---|---|
| AWS to the internet | Regional data transfer out, often called egress |
| Between AZs | Data transfer charged for traffic crossing AZ boundaries |
| Through a NAT gateway | NAT data-processing charges plus possible transfer charges |
| Between Regions | Cross-Region transfer and replication charges |
Check the current price for the Region and service involved. Do not assume that “private” traffic is free.
The Traffic Paths That Cost Money
A request from an EC2 instance can take several paths. It might reach S3 through a gateway endpoint, leave through a NAT gateway, cross an AZ to reach a load balancer, or travel across Regions to a replica.
Keep high-volume communicating resources in the same AZ when practical. Use caching and compression before sending large responses to internet clients.
Finding Transfer Costs in Cost Explorer
Cost Explorer groups charges by usage type. Filter for terms such as DataTransfer, NatGateway-Bytes, and service-specific transfer usage types. Grouping by usage type shows which category is growing.
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 textTracing Traffic with VPC Flow Logs
VPC Flow Logs record metadata about accepted and rejected network traffic. They do not record packet contents. CloudWatch Logs Insights can identify the largest source and destination pairs:
stats sum(bytes) as bytesTransferred by srcAddr, dstAddr
| sort bytesTransferred desc
| limit 10Use these results with resource and AZ information to find expensive paths.
Why NAT Gateways Inflate the Bill
A NAT gateway lets private-subnet resources make outbound connections. AWS charges for each gigabyte processed by the gateway. The same bytes may also incur internet, inter-AZ, or cross-Region transfer charges.
Exercise
An EC2 instance in a private subnet downloads large objects from S3 through a NAT gateway. What should you investigate first?
Show answer
Check Cost Explorer for NatGateway-Bytes, inspect the route table, and consider an S3 gateway endpoint.