The Cost Model and Reading the Bill

Topics Covered

How AWS Charges

The four units

Provisioned against on demand

Idle resources

Charges that surprise teams

Estimating before building

Price differences between regions

AWS pricing looks overwhelming because every service has its own price list, but almost every charge reduces to a small set of units: time a resource exists, requests made against it, data stored in it, and data moved out of it. Engineers who know which units drive each service in their architecture can estimate a design's cost before building it, explain a bill after it arrives, and spot the line that is growing faster than the business. This lesson works through those units, the charges that surprise teams most, the discounts that matter, and how to read and govern the bill.

The four units

The first unit is time: EC2 instances, RDS databases, NAT gateways, load balancers and provisioned capacity are billed per second or per hour while they exist, whether they are busy or idle. The second is requests: Lambda invocations, S3 GET and PUT calls, API Gateway requests, DynamoDB on demand reads and writes and KMS calls are billed per million or per thousand. The third is storage, billed per gigabyte month for S3, EBS, snapshots, backups and logs. The fourth is data transfer, billed per gigabyte moved between regions, between availability zones or out to the internet. Most bills are dominated by one or two of these.

Knowing the dominant unit for each service changes how engineers talk about cost. A Lambda function is rarely expensive because it exists; it is expensive because it is invoked often or runs long with a lot of memory, so the levers are request count, duration and memory size. An S3 bucket is expensive either because it holds a lot of data, which points at lifecycle rules and storage classes, or because it serves a lot of requests or transfer, which points at caching and CloudFront. An RDS instance is expensive because of its size and the hours it runs, which points at rightsizing and reservations. When a team names the unit before discussing the fix, the conversation moves straight to the change that will actually move the number instead of general advice about being careful with spending.

Provisioned against on demand

Many services offer two pricing models. Provisioned capacity, such as an EC2 instance, an RDS instance or DynamoDB provisioned throughput, costs the same whether it is used fully or not at all, so its cost per unit of work falls as utilisation rises. On demand models, such as Lambda, DynamoDB on demand and Fargate billed by the second, charge only for what runs, so cost tracks traffic. On demand is cheaper for spiky or low traffic workloads; provisioned is cheaper for steady high utilisation. The crossover point is often surprisingly low, which is why the choice should be revisited as traffic grows.

Lambda was cheaper below about 60 requests per second. Above it, two always on Fargate tasks cost less and the gap widened with every step.

Utilisation is the number that decides which model wins. A provisioned resource running at twenty percent utilisation pays for five times the work it does, while an on demand resource always pays exactly for its work but at a higher unit price. Lambda, for example, charges for every millisecond of every invocation, and a container that sits warm and handles many requests concurrently pays once for the time it runs. At low traffic the container mostly waits, which is wasteful, and at high steady traffic Lambda repeatedly pays a premium for work the container would do in bulk. The practical approach is to start new services on demand, where cost follows usage while traffic is unknown, and to compare against provisioned pricing once traffic has settled into a pattern that can be measured over several weeks.

Idle resources

Because time based resources cost money while idle, idle resources are a large share of waste in most accounts. Development environments running all weekend, load balancers in front of nothing, unattached EBS volumes, old snapshots, NAT gateways in unused VPCs and databases kept for a project that ended all accrue charges quietly. None of them appears as an error, and nobody is paged when they are forgotten. Scheduling non production environments to stop outside working hours, and regularly listing resources with no traffic, recovers money without affecting anything users see.

Finding idle resources is easier with a few standard queries. Load balancers with no healthy targets or near zero request counts, EBS volumes in the available state, snapshots older than a retention policy with no linked AMI, Elastic IPs not associated with a running instance, and RDS instances with no connections for weeks are all detectable from CloudWatch metrics and describe calls. Trusted Advisor and Compute Optimizer list several of these automatically. The harder part is ownership: when nobody knows who created a resource, nobody feels safe deleting it, so it survives indefinitely. Tagging resources with an owner at creation, and treating untagged resources as candidates for removal after a notice period, turns the cleanup from an archaeology project into a routine task.

Charges that surprise teams

A few charges regularly surprise teams. Public IPv4 addresses are billed hourly, including those attached to running instances, which adds up for fleets with many public addresses. NAT gateways charge per gigabyte processed in addition to their hourly rate, so heavy traffic through them is expensive. CloudWatch log ingestion, covered in the observability lesson, often exceeds the compute it describes. KMS charges per request, so a design that decrypts on every call can cost more in KMS than in compute. Each of these is easy to avoid once known and easy to miss otherwise.

Other surprises follow the same pattern of a small per unit price multiplied by a large hidden volume. S3 request charges matter for workloads that store millions of tiny objects, where the PUT cost can exceed the storage cost for years. DynamoDB scans read every item in a table and bill for all of it, so a scan run by a reporting job each hour can dwarf the cost of the application traffic. EBS snapshots are incremental, but a volume that rewrites most of its blocks daily produces snapshots nearly as large as the volume. Step Functions standard workflows charge per state transition, so a workflow with a tight polling loop can rack up millions of transitions. In each case the fix is a design change, and the clue is a line in the bill that is large relative to the work being done.

Estimating before building

Estimating cost during design is mostly arithmetic. For each component, identify the dominant unit and multiply by the expected volume: requests per month times price per million, gigabytes stored times price per gigabyte month, hours running times hourly price, gigabytes transferred times the transfer rate. The AWS Pricing Calculator helps assemble these, but the important skill is knowing which unit dominates. A design review that asks what the largest line will be at ten times today's traffic often catches architecture choices that would become expensive long before they are built.

At today's traffic compute was the biggest line. At ten times, data transfer out grew to 58 percent of the bill and needed a CDN in the design.

Price differences between regions

Prices differ between regions, sometimes by twenty percent or more for the same instance type, and data transfer between regions is charged. Running in a cheaper region can save money for workloads that do not need to be near particular users or data, such as batch processing or development environments, but it must be weighed against latency, data residency requirements and the transfer cost of moving data to and from the region. For most user facing systems, the region choice is driven by users and regulation, and price is a tie breaker.

Estimates should state their assumptions, because the assumptions are what change. An estimate that says the service will cost four thousand dollars a month is less useful than one that says it will cost four thousand at two hundred requests per second with an average response of fifty kilobytes and thirty days of log retention. When the real bill differs, the stated assumptions show which one was wrong, and the team learns something about its traffic as well as about its costs. Keeping estimates in the design document, and comparing them with the actual bill a month after launch, steadily improves the accuracy of future estimates and builds a habit of treating cost as a property of the design that can be predicted and checked.

Four units explain most bills

Know whether each component is billed by time, requests, storage or data transfer, choose provisioned or on demand pricing by utilisation, hunt idle resources and the classic surprises such as NAT processing and public IPv4, and estimate the largest line at ten times traffic during design.