Sub topic 2
The traffic paths that cost money
This chapter assumes you know what regions, Availability Zones (AZs), VPCs and subnets are. It also assumes you can read a route table and tell a public IP address from a private one. The prices below are approximate US East (N. Virginia) list prices. They vary by region and change over time, so check the pricing pages before you build a business case.
The previous chapter covered how AWS prices data transfer in general. This chapter works through the paths a packet can take and what each one costs. Once you can name the path, you can usually find the fix.
The core rule: price follows the path
AWS does not charge for "network usage" as one number. It charges per gigabyte (GB) for the boundary your traffic crosses. Two questions decide the price of any flow:
- Where does the packet leave from, and where does it arrive?
- Which address and which service does it pass through on the way?
The second question surprises people. Two instances in the same AZ can talk for free or for money, depending on which IP address one uses to reach the other.
The main paths
| Path | Typical price (per GB) | Charged on |
|---|---|---|
| Internet to AWS (inbound) | Free | Not charged |
| AWS to internet (outbound) | About $0.09 for the first 10 TB per month, falling with volume. The first 100 GB per month is free across services. | Sender |
| Between regions | About $0.02 | Sender |
| Between AZs in one region (private IPs) | About $0.01 in each direction | Both sides |
| Same AZ (private IPs) | Free | Not charged |
| Same AZ via public or Elastic IP | About $0.01 in each direction | Both sides |
| Through a NAT gateway | About $0.045 data processing, on top of any transfer charge | Per GB processed |
| Via a gateway VPC endpoint (S3, DynamoDB) | Free | Not charged |
| Via an interface VPC endpoint | About $0.01 data processing, plus an hourly fee per AZ | Per GB processed |
The sections below explain each row, and the diagram shows how they fit together.
Internet traffic
Inbound traffic from the internet is free. That includes uploads to S3 and requests arriving at a load balancer. Outbound traffic to the internet is the expensive direction, and it is tiered. The more you send in a month, the lower the per-GB rate. The free allowance of 100 GB per month applies across most services in an account, not per service.
Three details matter in practice:
- Egress is charged where the data leaves AWS. A response from an EC2 instance, an S3 object download, and an RDS export over a public endpoint are all outbound traffic.
- Responses count, not requests. A web server that receives small requests and returns large files pays for the files.
- CloudFront changes the rate. Transfer from an AWS origin (S3, EC2, an ALB) to CloudFront is free. You pay CloudFront's own egress rates to viewers, which are lower than EC2 direct rates and include a free monthly allowance. A later chapter covers this.
Inter-region traffic
Data that leaves one region for another is charged at the sender's inter-region rate, typically about $0.02 per GB from US regions and more from some others. The receiver does not pay a transfer fee for it.
This path appears in places that are easy to miss:
- S3 Cross-Region Replication and cross-region copies.
- Cross-region RDS read replicas, Aurora Global Database, and DynamoDB global tables.
- Backups copied to a disaster recovery region.
- An application in one region that calls a database or API in another.
Replication is usually deliberate. The surprise is a chatty service that was moved to a new region while its database stayed behind.
Inter-AZ traffic
Traffic between AZs in the same region costs about $0.01 per GB out of the source AZ and $0.01 per GB into the destination AZ. A flow in one direction therefore costs about $0.02 per GB in total. A request/response flow that moves data both ways is charged on both legs.
Typical sources:
- A load balancer with cross-zone load balancing sending traffic to targets in other AZs.
- A microservice in AZ a calling a service instance in AZ b.
- Database replication, such as a primary in one AZ and a standby in another.
- Kafka or other clustered systems that replicate between brokers in different AZs.
Multi-AZ designs are valuable for availability, so the goal is not to remove inter-AZ traffic. The goal is to avoid paying for avoidable cross-AZ calls and to know the cost of the traffic you keep.
Same-AZ traffic and the public IP trap
Traffic between two instances in the same AZ that use private IP addresses is free. The same instances talking over a public IP or Elastic IP are charged about $0.01 per GB in each direction, even though the packets never leave the AZ. AWS prices by the address used, because a public address implies the traffic may route out of the VPC and back.
The fix is to make instances resolve each other to private addresses. Use private DNS names, a private hosted zone, or service discovery. A common mistake is a configuration file that points one service at another service's public DNS name. Inside a VPC that name resolves to the private IP for instances in the same VPC when DNS hostnames and resolution are enabled, but an Elastic IP in a hand-written address, or a name that resolves externally, will not.
Managed network services in the path
Some services add their own per-GB fee on top of the transfer category. These charges apply even when the underlying path would be free.
NAT gateways
A NAT gateway lets private subnets reach the internet. It charges an hourly fee and about $0.045 per GB processed, in both directions. That fee is separate from the transfer charge. A private instance that downloads 1 TB from a public site through a NAT gateway pays NAT processing for that terabyte. Traffic from a private subnet to S3 in the same region is free of transfer charges, but if it goes through a NAT gateway it still pays the processing fee. This is why NAT gateways often appear as one of the largest lines on a bill. The following chapters on NAT gateways and VPC endpoints cover the fix.
A related trap: a NAT gateway in AZ a that serves instances in AZ b adds an inter-AZ charge as well as NAT processing. A common recommendation is one NAT gateway per AZ, with each AZ's route table pointing to its own.
VPC endpoints
A gateway endpoint exists for S3 and DynamoDB. It has no hourly or per-GB charge. Traffic from your subnet to the service goes through the endpoint and bypasses the NAT gateway. An interface endpoint (AWS PrivateLink) works for many services. It costs an hourly fee for each AZ it is deployed in, plus about $0.01 per GB processed. That is cheaper than NAT processing for high volumes but not free.
Transit Gateway and peering
Transit Gateway charges an hourly fee per attachment and about $0.02 per GB of data processed. VPC peering has no hourly fee or processing fee, but you still pay the inter-AZ or inter-region charge that applies to the path. Cross-AZ peering traffic is charged as inter-AZ.
Hybrid links
Site-to-Site VPN and Direct Connect have their own hourly or port fees. Data going from AWS to your data center is charged an outbound rate. For Direct Connect this is lower than the internet rate, and inbound is free.
Reading a bill with this model
When a transfer line looks high, work through these steps:
- Identify the direction. Is the data leaving AWS, crossing a region, or crossing an AZ?
- Check whether the address used is public or private.
- Check whether a managed service (NAT gateway, endpoint, Transit Gateway) is in the path and adds a processing fee.
- Check whether the traffic is intentional (replication, backup) or incidental (a misconfigured address).
The next chapter turns this into a practical method using Cost Explorer usage types, which name the path for each charge on your bill.
Exercise
An application server in us-east-1a reads 2 TB per month of objects from an S3 bucket in us-east-1. The server is in a private subnet that routes to a NAT gateway, and the NAT gateway sits in us-east-1b. List every charge this traffic triggers at roughly $0.045 per GB NAT processing and $0.01 per GB each direction between AZs. Then name the change that removes most of the cost.
Show answer
The S3 transfer itself is free because it stays in the region. The traffic still pays NAT gateway processing, about 2,048 GB x $0.045, which is roughly $92 per month. Because the NAT gateway is in a different AZ from the server, the traffic also crosses an AZ boundary and pays about $0.01 per GB on each side. The fix is to add an S3 gateway endpoint and attach it to the private subnet's route table. S3 traffic then bypasses the NAT gateway and costs nothing for transfer or processing.