Sub topic 7
Not forgetting data transfer
Data transfer is the cost most often missing from a first estimate. Compute and storage line items are easy to find because you pick them by name. Data transfer is charged for traffic moving between places, and the calculator won't add it unless you enter it. This chapter covers which traffic is charged, how to enter it, and how to avoid understating the total.
This chapter assumes you can read a monthly cost breakdown. It also assumes you know what Regions and Availability Zones (AZs) are, and have already configured a service and its usage in the calculator.
Why data transfer gets missed
Data transfer is a pricing dimension, but it is rarely the main thing you are buying. You choose an instance type, a database size, or a bucket. You rarely choose "bytes crossing a boundary". The charge appears on the bill under the service that sent or processed the traffic, often with a name like DataTransfer-Out-Bytes or DataTransfer-Regional-Bytes.
Three things make it easy to understate:
- Many calculator service pages show data transfer in a separate section that defaults to zero.
- Traffic between your own components, such as an app tier calling a database in another AZ, feels free but often is not.
- Some charges belong to a supporting service, such as a NAT gateway, not to the service that generates the traffic.
The direction and boundary rules
Whether traffic is charged depends on where it starts and where it ends. These are the general rules. Confirm exact rates on the service's pricing page, because they differ by Region and change over time.
| Traffic path | Typically charged? | Notes |
|---|---|---|
| Internet into AWS (inbound) | No | Services that process the data may still charge for it. |
| AWS out to the internet | Yes, per GB | Tiered, with a monthly free allowance (see below). |
| Between Regions | Yes, per GB | Billed to the sending Region. |
| Between AZs in one Region | Yes, per GB | Usually charged in each direction. |
| Within one AZ over private IP | No | Public or Elastic IP addresses can change this. |
| S3 to EC2 in the same Region | No | Request and storage charges still apply. |
| Origin to CloudFront | No | CloudFront's own delivery to viewers is priced separately. |
The free allowance
AWS gives a monthly free allowance for data transferred out to the internet. It is aggregated across services and Regions in your account, not given per service. If you add the same allowance to three separate service configurations, you subtract it three times and understate the total. Apply it once, to the whole estimate, or let the calculator handle it where it models the Free Tier.
Tiered pricing
Outbound internet transfer is priced in tiers. The per-GB rate falls as monthly volume rises, for example a rate for the first 10 TB, a lower rate for the next 40 TB, and so on. The calculator applies the tiers to the volume you enter for a service. If you split one workload's outbound traffic across several services, each service starts again at the top tier. That overstates the cost when the traffic would really share tiers.
Entering data transfer in the calculator
Where the inputs appear depends on the service. Many service configuration pages, including Amazon EC2, have a data transfer section with fields for inbound, outbound, and intra-Region traffic. Other services, such as CloudFront, treat delivery as their main priced item. Always scroll past the compute and storage fields to look for it.
Follow this process for each workload:
- Draw the traffic paths. List every place data crosses an internet, Region, or AZ boundary.
- Estimate monthly GB for each path, using the same units the calculator field expects (GB per month, or TB per month).
- Enter each volume on the service that sends the traffic.
- Add the supporting services that process or move the traffic.
- Check the estimate's per-service breakdown to confirm that no data transfer line is zero by accident.
Estimating volume from requests
You rarely know GB per month directly. Derive it from request counts and average response size:
monthly outbound GB = requests per month × average response size in MB ÷ 1000Use the average of real responses, not the size of one page. Compression, caching, and image-heavy pages can shift the average a lot. If you have an existing system, take the figure from your load balancer or CDN logs instead of guessing.
Supporting services that carry data transfer cost
Some of the largest data transfer charges are not on the service that produces the traffic. Add these where they apply.
- NAT gateway. It has an hourly charge and a per-GB data processing charge. Private subnets that pull container images, OS updates, or S3 objects through a NAT gateway pay that processing fee on every GB. Standard data transfer charges can apply on top.
- VPC endpoints. Gateway endpoints for S3 and DynamoDB have no hourly or processing charge. Interface endpoints have an hourly charge per AZ and a per-GB processing charge. Routing S3 traffic through a gateway endpoint instead of a NAT gateway is a common way to remove a charge from an estimate.
- Load balancers. They charge by the hour plus a capacity-based usage unit (for example, Load Balancer Capacity Units), which is driven partly by bytes processed.
- CloudFront. Delivery to viewers is priced per GB and per request, with a monthly free allowance. Transfer from an AWS origin to CloudFront is not charged, so putting a CDN in front of an origin can lower the total even though it adds a line item.
- Public IPv4 addresses. Each public IPv4 address has an hourly charge, whether or not it is attached to a busy workload.
A hand calculation to check the calculator
You can reproduce a data transfer line item yourself, which helps you spot a field you entered wrongly. The rates below are illustrative placeholders, not current AWS prices.
def tiered_cost(gb, tiers):
"""Cost of gb under tiered pricing.
tiers is a list of (tier_size_gb, rate_per_gb) pairs in order.
Use None as the size of the last tier to mean "everything left".
"""
remaining = gb
total = 0.0
for size, rate in tiers:
billable = remaining if size is None else min(remaining, size)
total += billable * rate
remaining -= billable
if remaining <= 0:
break
return total
# Illustrative tiers: free allowance, then two paid tiers, then the rest.
OUTBOUND_TIERS = [
(100, 0.00), # monthly free allowance
(10140, 0.09), # rest of the first 10 TB (10,240 GB)
(40960, 0.085), # next 40 TB
(None, 0.07), # everything beyond that
]
CROSS_AZ_RATE = 0.01 # per GB, charged in each direction (illustrative)
def cross_az_cost(gb_a_to_b, gb_b_to_a, rate=CROSS_AZ_RATE):
return (gb_a_to_b + gb_b_to_a) * rate
outbound = tiered_cost(15000, OUTBOUND_TIERS)
cross_az = cross_az_cost(2000, 500)
print(f"Outbound to internet: {outbound:.2f}")
print(f"Cross-AZ traffic: {cross_az:.2f}")
print(f"Total data transfer: {outbound + cross_az:.2f}")Running it prints 1317.20 for outbound traffic, 25.00 for cross-AZ traffic, and 1342.20 in total. If the calculator's figure for the same volumes differs by more than rounding, check the Region, the tier boundaries, and whether you entered the free allowance twice.
Common errors
- Entering GB where the field expects TB, or the reverse. A thousandfold error here is easy to make. Check the unit label beside each field.
- Counting the free allowance once per service. It applies to your account's aggregate outbound traffic.
- Ignoring replication. Cross-Region replication of S3 objects, database read replicas, and backups copied to another Region all generate inter-Region charges, often in addition to the storage in the destination.
- Pricing only the primary Region. Charges for a transfer land in the sending Region, so check that the sending service is configured in the right Region.
- Assuming "private" means free. Traffic over private IPs within one AZ is free, but traffic across AZs, through a NAT gateway, or through an interface endpoint is not.
- Treating the average as the peak. Data transfer is billed on total GB, not on rate. A spiky workload costs the same as a steady one that moves the same total, but your capacity inputs for other services may differ.
Checking the result
After you add data transfer, review the estimate as a whole:
- Compare the data transfer share of the total with a similar existing workload. For content-heavy sites and data pipelines it can be a large fraction. For a small internal tool it may be close to zero.
- Add a line to the estimate's description that states each traffic assumption, such as "assumes 80% of responses are served from CloudFront cache". Reviewers can then challenge the number.
- Run a lower and a higher volume scenario to see how sensitive the total is to this one input.
Exercise
A workload has 10 web servers in two AZs that send 3,000 GB per month to databases in the other AZ and receive 1,000 GB back. Cross-AZ transfer is charged at 0.01 per GB in each direction, and each server sends 200 GB per month to the internet (an account-wide free allowance of 100 GB applies). Which of these figures would you enter or calculate, and why is entering the free allowance for every server a mistake?
Show answer
Cross-AZ cost is (3,000 + 1,000) × 0.01 = 40.00 per month, because both directions are charged. Outbound internet traffic is 10 × 200 = 2,000 GB per month in total. The 100 GB free allowance applies once across the account, so 1,900 GB is billable at the tiered outbound rate. Subtracting 100 GB for each of the 10 servers would remove 1,000 GB and understate the cost.
Exercise
Private subnets in your design pull 5,000 GB per month from S3 in the same Region through a NAT gateway. What change to the design would remove most of this cost, and which estimate line items change?
Show answer
Add an S3 gateway endpoint to the VPC and route S3 traffic through it. Gateway endpoints have no hourly or per-GB processing charge, so the NAT gateway's per-GB data processing line for those 5,000 GB drops to zero. The NAT gateway's hourly charge remains if other traffic still uses it, and same-Region S3 to EC2 transfer was already free.