Volume 1 · Chapter 5 — AWS Foundations and Cloud Computing

Pricing, Cost Management, and the Billing Model

Goutham Mayaluri 10 min read AWSCloudCloud Computing

5.1 Introduction

Cost is an architectural concern in the cloud, not just a finance one. Because you pay for what you provision and use, engineering decisions - instance sizes, whether environments run overnight, which storage class you pick, how much data crosses Regions - translate directly into the bill. Engineers who understand the pricing model design cheaper systems without sacrificing performance or resilience, and they can answer the “how would you reduce this cost?” questions that come up in senior interviews. This chapter covers how AWS charges and the levers you pull to control it.

5.2 The Fundamentals of AWS Pricing

AWS pricing rests on a few consistent ideas. You pay as you go, for what you use, with no large upfront commitment required. The three things you generally pay for are compute (how much and how long you run processing), storage (how much data you keep and in what class), and data transfer (particularly data leaving AWS to the internet or moving across Regions - inbound is usually free, and outbound is where surprises hide). Pricing varies by Region. And there’s a meaningful free tier for learning. The practical consequence is that idle-but-running resources still cost money, oversizing is pure waste, and data egress is an often-overlooked line item - so cost control is mostly about not paying for capacity you aren’t using and not moving data unnecessarily.

5.3 Compute Pricing Models

For compute specifically, AWS offers several purchasing models that trade commitment for discount. On-Demand is the default - you pay per second/hour with no commitment, ideal for variable or unpredictable workloads. Savings Plans and Reserved capacity give substantial discounts (often large) in exchange for committing to a consistent amount of usage over one or three years - ideal for steady baseline workloads you know you’ll run continuously. Spot capacity offers the steepest discounts by using AWS’s spare capacity, but it can be reclaimed with little notice, so it suits fault-tolerant, interruptible workloads (batch processing, non-critical analytics) rather than a bank’s core transaction path. And serverless (Lambda) charges only per request and execution time, so idle costs nothing at all. The senior pattern is to cover a predictable baseline with a commitment for the discount, handle variable peaks with On-Demand or serverless, and use Spot only for interruptible work.

flowchart TD
  Q{Workload shape?} -->|Steady 24/7 baseline| Commit[Savings Plan / Reserved - big discount for commitment]
  Q -->|Variable / unpredictable| OnDemand[On-Demand - pay per use, no commitment]
  Q -->|Spiky, event-driven| Serverless[Lambda - pay per request, zero idle cost]
  Q -->|Interruptible batch| Spot[Spot - cheapest, can be reclaimed]

5.4 Storage and Data Transfer Costs

Storage cost depends on how much you keep and which class you use. Object storage (S3) offers tiers from frequently-accessed to rarely-accessed archival storage that costs a fraction as much, and lifecycle rules can move data to cheaper tiers automatically as it ages - important for a bank keeping years of statements for compliance where most data is old and rarely read. Block storage (EBS) is billed for the capacity you provision whether or not you fill it, so oversized volumes waste money. Data transfer is the sleeper cost: data coming into AWS is generally free, but data going out to the internet, and data crossing between Regions or sometimes between AZs, is charged - so architectures that shuttle large volumes of data across Regions, or serve lots of traffic straight from the Region instead of caching at the edge, can rack up unexpected egress bills.

5.5 Managing and Governing Cost

AWS provides tools to see and control spend. Cost Explorer and cost and usage reports show where money goes, broken down by service, account, and tag - which is why tagging resources by team, environment, and application is essential for attributing cost. Budgets let you set thresholds and get alerted (or take action) before spend runs away. At the organization level, consolidated billing across many accounts aggregates usage for volume discounts and central visibility. The disciplines that actually keep costs down are right-sizing (matching instance size to real usage), shutting down non-production environments when idle, committing to steady baselines for the discount, using lifecycle policies for storage, and watching data egress - all made visible by good tagging and budgets.

5.6 Banking Production Scenario

A bank runs its steady core-banking baseline on committed capacity (a Savings Plan) for a large discount, while absorbing payday spikes with On-Demand capacity added by Auto Scaling and removed afterwards. Overnight batch reconciliation runs on Spot capacity because it’s interruptible and restartable. Years of customer statements sit in cheap archival object storage under a lifecycle policy that moves them there automatically after 90 days, since regulation requires retention but the data is rarely read. Every resource is tagged by application and environment, so Cost Explorer attributes spend precisely, and budgets alert the platform team if any environment exceeds its expected cost. Non-production accounts shut their compute down outside business hours. The result is strong resilience and performance at a cost that tracks real usage.

5.7 Troubleshooting: Runaway Spend

The typical cost incident is a bill that suddenly jumps, and the usual causes are a handful of repeat offenders: forgotten resources left running (an oversized instance or a test environment nobody shut down), unattached but still-billed storage volumes and old snapshots, unexpected data-egress from moving large volumes across Regions or serving uncached traffic, and oversized instances provisioned “to be safe.” The way to diagnose it is to use Cost Explorer to find which service and which tag drove the increase, which is only possible if resources are tagged. The fixes follow the cause: right-size or terminate idle resources, clean up orphaned storage, cache at the edge or restructure data flows to cut egress, and set budgets with alerts so the next spike is caught early rather than discovered on the invoice. The preventive discipline is tagging, budgets, and regular right-sizing reviews.

Interview Question

How does AWS pricing work, and how would you reduce the cost of a workload without hurting performance or resilience?

AWS pricing is pay-as-you-go: you pay for what you provision and use, primarily across three dimensions - compute (how much processing you run and for how long), storage (how much data you keep and in which class), and data transfer (especially data leaving AWS to the internet or crossing Regions, while inbound is generally free). Prices vary by Region, and crucially, resources that are running but idle still cost money. To reduce a workload’s cost without sacrificing performance or resilience, I pull several levers. First, right-sizing: match instance sizes to actual measured usage rather than provisioning oversized “to be safe,” since oversizing is pure waste - and I verify with utilization metrics. Second, choose the right compute purchasing model for the workload’s shape: cover the steady 24/7 baseline with a Savings Plan or Reserved capacity for a large discount, handle variable peaks with On-Demand or serverless (Lambda, which costs nothing when idle), and run interruptible batch work on Spot for the deepest discount - so I’m not paying On-Demand rates for predictable baseline load. Third, eliminate idle spend: shut non-production environments down outside business hours and terminate forgotten resources, because a dev environment doesn’t need to run overnight. Fourth, optimize storage: use cheaper storage classes and lifecycle policies that automatically move aging data to archival tiers - a bank keeping years of statements for compliance can store the old, rarely-read data far more cheaply - and clean up orphaned volumes and old snapshots. Fifth, cut data transfer: cache content at the edge with a CDN instead of serving everything from the Region, and avoid unnecessary cross-Region data movement, since egress is a common hidden cost. Importantly, none of these hurt performance or resilience - right-sizing is based on real usage, commitments and Spot don’t change architecture, lifecycle policies only move cold data, and edge caching actually improves performance. What I would not do is compromise resilience to save money, like collapsing to a single AZ. Underpinning all of it, I tag every resource by team, environment, and application and use Cost Explorer and Budgets so spend is visible, attributable, and alerted before it runs away. So the answer is a systematic set of levers - right-size, match the pricing model to the workload, kill idle capacity, tier storage, reduce egress, and govern with tagging and budgets - that reduce cost precisely by removing waste rather than by cutting the capability, performance, or resilience the workload actually needs.

Interview Question

When would you use On-Demand, Reserved/Savings Plans, Spot, and serverless compute?

Each compute purchasing model fits a different workload shape, and matching them is a core cost-design skill. On-Demand is the default: you pay per second or hour with no commitment and full flexibility, so I use it for workloads that are variable, unpredictable, short-lived, or new - anything where I can’t or don’t want to commit to steady usage, and for absorbing spikes on top of a committed baseline. Reserved capacity or Savings Plans give a large discount in exchange for committing to a consistent amount of usage over one or three years, so I use them for steady, predictable baseline workloads I know will run continuously - the always-on core of an application - because there the commitment is safe and the discount is substantial; it would be wasteful to pay On-Demand rates for capacity I run 24/7 all year. Spot uses AWS’s spare capacity at the steepest discount but can be reclaimed with little notice, so I use it only for fault-tolerant, interruptible workloads that can be stopped and resumed - batch processing, data crunching, CI jobs, non-critical analytics - and never for a bank’s core transaction path, because an interruption there would be unacceptable. Serverless (Lambda) charges only per request and execution time with zero cost when idle, so I use it for event-driven, spiky, or intermittent workloads where paying nothing during idle periods is a big advantage and I don’t need to manage servers - and it scales to zero and back automatically. The senior pattern combines them: cover the predictable baseline with a Savings Plan for the discount, handle variable peaks with On-Demand or serverless, and offload interruptible batch work to Spot - which minimizes cost while preserving the reliability the critical path needs. The reasoning is always the trade between commitment and flexibility versus discount, bounded by how tolerant the workload is of interruption: steady and predictable justifies commitment; variable needs flexibility; interruptible can chase the deepest discount; and event-driven benefits from paying only per use.

Chapter Revision Notes

  • Pay-as-you-go across compute, storage, and data transfer; prices vary by Region; idle-but-running resources still cost money.
  • Compute models: On-Demand (variable), Savings Plans/Reserved (steady baseline discount), Spot (cheap, interruptible), serverless (zero idle cost).
  • Storage: use cheaper classes and lifecycle policies for aging data; clean up orphaned volumes/snapshots.
  • Data egress (out to internet/cross-Region) is the common hidden cost; cache at the edge and avoid needless cross-Region movement.
  • Govern with tagging, Cost Explorer, and Budgets; the core disciplines are right-sizing, killing idle spend, and matching the pricing model.