Sub topic 2
Where the money goes: compute, storage and data transfer
This chapter assumes you have used EC2, S3 and VPC networking at a basic level and can run AWS CLI commands. It also assumes you can read JSON. The goal is a working model of how an AWS bill is built, so you can predict which line items will grow and why.
The billing model in one idea
Almost every AWS charge is a meter multiplied by a rate. A meter counts something: instance-hours, GB-months stored, GB transferred, requests made. The rate is a price per unit that depends on the Region, the product, and the option you chose.
Your bill is the sum of many meters, and each meter grows for its own reason. To control cost, you have to know which meter is moving.
Three families of meters account for most spend in typical accounts:
- Compute meters count time that capacity is reserved for you.
- Storage meters count how much data you keep, and often how many requests touch it.
- Data transfer meters count bytes that cross a boundary, such as the internet, a Region, or an Availability Zone.
Compute: you pay for time, not for work
For compute, the main meter is the time a resource exists, not how busy it is. An EC2 instance at 2 percent CPU costs the same per hour as one at 95 percent. This is why idle and oversized instances are the most common source of waste, and why later chapters cover rightsizing and scheduling.
What drives the compute meter:
- Instance size and family. Price roughly doubles with each size step within a family (for example,
largetoxlarge). Newer generations and Arm-based processors are often cheaper for the same work. - Hours running. An instance left on for a 730-hour month costs about 3.5 times as much as the same instance run only during a 40-hour work week of roughly 173 hours per month.
- Purchase option. On-demand, committed and spot capacity have different rates for identical hardware. Commitments and spot are covered in their own chapters.
- Managed services. RDS, OpenSearch, EKS control planes and similar services bill for provisioned hours on top of the underlying capacity. Many of them bill whether or not anyone is querying them.
- Serverless. Lambda and Fargate bill per request and per unit of memory and CPU over time. They remove idle cost, but a high-volume or inefficient function can still cost more than a small always-on instance.
A worked example: an m5.xlarge at an illustrative $0.20 per hour costs about $146 in a 730-hour month. Ten of them left running over a weekend that nobody uses (roughly 60 hours) cost about $120 for that weekend alone. Check the current rates on the AWS pricing pages before you rely on numbers like these.
Storage: small rates, large volumes, long lifetimes
Storage rates look cheap per GB, but data accumulates and is rarely deleted. The meter is GB-months: how much you hold, averaged over time.
Common storage cost sources:
- S3 storage class. S3 Standard costs more per GB than Standard-IA, Glacier tiers, and so on. Cold data in a hot class is a steady overspend.
- S3 requests and retrieval. The cheaper classes charge more for reads and retrieval, and some have minimum storage durations. Moving frequently read data to a cold class can raise the bill.
- Versioning. A versioned bucket keeps every old version, and each one is billed. Heavy overwrites can multiply stored size.
- EBS volumes. EBS bills for provisioned size (and for provisioned IOPS and throughput on some volume types), whether or not the volume is full or even attached.
- Snapshots. Snapshots are incremental, but a long retention schedule on many volumes adds up. Snapshots outlive the volumes and instances they came from.
- Databases and backups. Backup storage beyond the free allowance is billed per GB-month.
The EBS point matters in practice. You pay for the size you provisioned, not the data you wrote. A 500 GiB volume holding 40 GiB of data is billed for 500 GiB.
Data transfer: the meter people forget
Data transfer is hard to see because no single resource "owns" it. Bytes are billed when they cross a boundary, and the direction matters.
| Traffic path | Typical billing |
|---|---|
| Internet into AWS (ingress) | Generally free |
| AWS out to the internet (egress) | Billed per GB, with a small monthly free allowance |
| Between AWS Regions | Billed per GB |
| Between Availability Zones in one Region | Billed per GB, in each direction |
| Within one AZ over private IPs | Generally free |
| Through a NAT gateway | Hourly charge plus a per-GB processing charge, on top of any transfer charge |
Rates differ by Region and change over time, so confirm them on the pricing pages.
Patterns that quietly create transfer cost:
- Chatty cross-AZ designs. A service in one AZ calling a database or cache in another pays per GB for each request and response. High availability is worth it, but the traffic pattern should be a deliberate choice.
- NAT gateway as the default path. Private subnets that reach S3 or DynamoDB through a NAT gateway pay processing fees on every GB. Gateway VPC endpoints for S3 and DynamoDB avoid that charge.
- Serving large files straight from S3 or EC2. Egress is billed per GB. A CDN such as CloudFront can reduce egress cost and also cache repeat requests.
- Cross-Region replication and backups. Each copy pays transfer and also doubles storage.
Finding the dominant meter with the CLI
The Cost Explorer API can group last month's spend by service. This shows which family is largest.
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=SERVICEThe End date is exclusive, so this covers all of October. The output lists one group per service with an Amount string and a Unit. If "EC2 - Other" ranks high, drill into it by grouping on USAGE_TYPE with a filter:
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 \
--filter '{"Dimensions":{"Key":"SERVICE","Values":["EC2 - Other"]}}'Usage type names tell you the meter. Names containing NatGateway-Bytes point to NAT processing, DataTransfer-Regional-Bytes to cross-AZ traffic, EBS:VolumeUsage to volume storage, and EBS:SnapshotUsage to snapshots. The exact strings vary by Region prefix, so read what your account returns instead of matching on a fixed list.
Common errors when reading the bill
- Assuming utilization lowers compute cost. Instances bill by time. Low CPU is a signal to resize or stop, not a discount.
- Optimizing the biggest resource instead of the biggest meter. One large instance may cost less than thousands of small NAT or cross-AZ charges.
- Ignoring unattached resources. Volumes, snapshots, Elastic IPs and load balancers keep billing after the workload that used them is gone.
- Moving data to a cold storage class without checking access patterns. Retrieval fees and minimum durations can exceed the savings.
- Comparing months of different length. A 31-day month has about 3 percent more hours than a 30-day month. Compare daily averages when you look for small shifts.
- Treating data transfer as a networking team problem. The traffic is generated by application design, so the fix is usually architectural.
What to remember
Rank your meters before you optimize. Compute rewards turning things off or shrinking them. Storage rewards deleting data and matching class to access pattern. Data transfer rewards keeping traffic local and avoiding paid paths. The next chapters build on this: you will see spend with billing tools, attribute it to owners, and then act on each family.
Exercise
Your Cost Explorer output by service shows "EC2 - Other" as your second-largest line, and no EC2 instances were added this month. What is your next step, and which usage types would suggest a NAT gateway problem versus cross-AZ traffic?
Show answer
Group the "EC2 - Other" spend by USAGE_TYPE with a filter on that service, because the line bundles EBS, snapshots, NAT and some data transfer. Usage types containing NatGateway-Bytes (and NatGateway-Hours for the hourly part) point to NAT gateway processing. Usage types containing DataTransfer-Regional-Bytes point to traffic between Availability Zones in one Region. A likely fix for NAT cost is a gateway VPC endpoint for S3 or DynamoDB. For cross-AZ cost, review which services talk across zones and whether that is needed.
Exercise
A 500 GiB gp3 EBS volume holds 40 GiB of data and is not attached to any instance. Which meters are you paying for, and how would you list such volumes?
Show answer
You pay for the provisioned 500 GiB per month (plus any provisioned IOPS and throughput above the included baseline), not the 40 GiB used, and attachment status does not matter. Any snapshots of it add a separate storage charge. List unattached volumes with aws ec2 describe-volumes --filters Name=status,Values=available.