Sub topic 2
The traffic paths that cost money
This chapter assumes you know what regions, Availability Zones (AZs), VPCs, and subnets are, and that you can read a route table. The rates below are approximate us-east-1 list prices. Check the AWS pricing pages for your region before you plan around a number.
The core rule: the path sets the price
AWS does not charge for data transfer as one flat rate. It charges for the path the bytes take. Two requests of the same size can cost nothing or cost real money, depending on where they start, where they end, and which address they use.
The main paths
| Path | Typical charge | Notes |
|---|---|---|
| Internet into AWS | Free | Inbound traffic is not billed. |
| AWS out to the internet | About $0.09/GB after a small monthly free tier | The most visible transfer cost. |
| Between regions | About $0.02/GB, billed on the sending side | The rate depends on the region pair. |
| Between AZs in one region | About $0.01/GB in each direction | Both the sender and the receiver pay, so a round trip costs about $0.02/GB. |
| Within one AZ, private IP | Free | The cheapest path. |
| Within one AZ, public or Elastic IP | About $0.01/GB in each direction | The public address makes the traffic billable. |
| Through a NAT gateway | About $0.045/GB processed, plus an hourly fee | Added on top of the other transfer charges. |
How the paths fit together
Three details that surprise people
Public addresses cost money inside AWS. If two instances in the same AZ talk to each other through public or Elastic IPs, AWS bills the traffic as if it had left the AZ. Use private addresses or private DNS names for internal calls.
Inter-AZ traffic is billed twice. The sending AZ is charged for the bytes it sends, and the receiving AZ is charged for the bytes it receives. A chatty service that spreads its replicas across three AZs can pay for this on every call.
NAT gateways add a second meter. Traffic from a private subnet to the internet pays the NAT gateway processing fee. It then pays the internet egress rate as well. Traffic from a private subnet to S3 through a NAT gateway pays the NAT fee even though S3 is inside AWS. That is why NAT gateways get their own chapter later.
Common errors when classifying traffic
- Assuming "same region" means free. Only same-AZ private traffic is free. Cross-AZ traffic in the same region is not.
- Forgetting service-to-service paths. Load balancers, databases with replicas, and managed services such as Kafka often send traffic between AZs without you writing any code that does it.
- Mixing up inbound and outbound. Uploading a large file to S3 from the internet is free. Downloading it again is not.
Sketching your own paths
Before you open any billing tool, draw one request from the client to the data store and back. Mark every hop where traffic crosses an AZ, a region, a NAT gateway, or the internet boundary. Each mark is a possible charge. The next chapters show how to measure which marks cost the most.
Exercise
A web server in us-east-1a calls a database in us-east-1b, using the database's private IP. It sends 100 GB of queries and receives 400 GB of results in a month. Using $0.01/GB in each direction, what is the approximate inter-AZ charge, and how would moving the database to us-east-1a change it?
Show answer
The 500 GB total crosses an AZ boundary. Each byte is charged $0.01 on the sending side and $0.01 on the receiving side, so the cost is 500 × $0.02 = about $10. If both resources were in us-east-1a and used private IPs, the charge would be $0. The trade-off is that a single-AZ database loses the resilience that a multi-AZ design gives you.