Chapter 5 · Part 1: Cloud and AWS Foundations
AWS Pricing: Become Your Own AWS Calculator
Goal: learn to predict an AWS bill before you build. You will learn what AWS actually charges for, how to convert any design into a monthly number, where the hidden costs live, how discounts work, and how to cut a bill by 40 percent without breaking anything. By the end you can price a design on a napkin, defend the number, and then confirm it with the official tools.
Reading time: about 70 minutes. Lab time: 40 minutes. Lab cost: $0 (you only estimate, you do not build).
How to read this chapter: keep a notepad open and redo the arithmetic yourself. Prediction is a skill built by doing the sums. Go Deeper boxes are optional.
Important note on prices: AWS prices differ by Region and change over time. The structure of AWS pricing (what is metered and how) is stable and is what you must master. The numbers in this chapter come from one rounded "teaching price sheet", based on US East (N. Virginia) list prices as understood in late 2026, so that every sum is easy to check. Mumbai and other Regions often cost more, by a few percent up to about 25 percent for some services. Section 5.7 and the lab show you how to fetch the exact live price for your Region. Never quote a teaching price to a customer.
What You Will Be Able to Do After This Chapter#
- Explain why an AWS bill is always price times quantity for a list of meters, and name the meters of the 15 most common services.
- Turn any architecture into a monthly estimate with a repeatable five-step method, and state your assumptions.
- Do the core conversions in your head: hours to months, requests per second to requests per month, GB-months, and Lambda GB-seconds.
- Choose between On-Demand, Savings Plans, Reserved Instances and Spot, and compute the break-even utilization.
- Find the hidden costs (NAT gateways, public IPv4, cross-AZ traffic, logs, idle resources) before they find you.
- Price the same application as serverless and as a three-tier design, explain where the money goes, and find the crossover point.
- Use the AWS Pricing Calculator, the Price List API, Cost Explorer, Budgets and Data Exports for the right questions.
- Present low, expected and high scenarios, a cost per order, and twelve levers to reduce the bill.
The Big Picture: A Taxi Meter, Not a Price Tag#
Most things you buy have a price tag: you pay once, you own it. AWS works like a taxi meter. The fare depends on several meters running at the same time, and you only know the final number when the ride ends. A good predictor learns every meter and guesses how far the ride will go.
| Taxi fare | What it is | AWS equivalent | Example |
|---|---|---|---|
| Base fare while the car is hired | You pay for time, not for use | Hourly resources | An EC2 instance, a NAT gateway, a load balancer, a database instance: billed every hour they exist |
| Per kilometer | You pay for how much you actually use | Usage meters | Per request, per GB transferred, per GB stored, per millisecond of compute |
| Waiting time | Paying while nothing useful happens | Idle resources | A server at 3 percent load, a forgotten volume |
| Airport surcharge and tolls | Extras you did not think about | Hidden costs | Data transfer, public IPv4 addresses, logs, support, tax |
| Monthly pass | Commit to ride a lot, get a lower rate | Savings Plans and Reserved Instances | A 1-year commitment for a lower hourly rate |
| Standby cab with a big discount | Cheap, but it may be taken away | Spot Instances | Spare capacity at up to 90 percent off |
The whole chapter in 60 seconds: every AWS charge is a price times a quantity on a meter. Some meters run by the hour whether you use the resource or not (servers, NAT gateways, load balancers, databases). Others run by use (requests, GB stored, GB transferred, milliseconds of compute). To predict a bill: list the components, find each one's meters, estimate each meter's quantity, multiply, add the hidden costs, add a buffer, and state your assumptions. A month has 730 hours, so hourly price times 730 is the monthly price. Discounts come from committing (Savings Plans, up to 66 or 72 percent), volume (tiers), free allowances, and spare capacity (Spot, up to 90 percent). Beginners overestimate compute and underestimate networking: in a typical small three-tier design, NAT gateways, load balancers and data transfer cost more than the servers.
Jargon Buster#
| Term | Plain meaning |
|---|---|
| Meter / pricing dimension | One thing AWS measures and bills: an instance-hour, a GB-month, a million requests. |
| On-Demand | Pay the standard list price, by the second or hour, with no commitment. |
| Savings Plan | A commitment to spend a fixed amount per hour for 1 or 3 years, in return for a lower rate. |
| Reserved Instance (RI) | An older commitment tied to specific instance details, in return for a discount. |
| Spot Instance | Spare EC2 capacity at a steep discount that AWS can take back with 2 minutes' notice. |
| GB-month | Storing 1 GB for one month. Storing 10 GB for half a month is 5 GB-months. |
| GB-second | Lambda's compute unit: memory in GB multiplied by run time in seconds. |
| Egress | Data leaving AWS to the internet (or to another Region). The costly direction. Ingress, data coming in, is free. |
| Tiered pricing | The price per unit falls as your volume rises (the first 10 TB at one price, the next 40 TB cheaper). |
| Fixed vs. variable cost | Fixed: cost that stays the same whatever the traffic (a server). Variable: cost that grows with traffic (a request). |
| Unit economics | The cost to serve one unit of business value: per order, per user, per 1,000 requests. |
| FinOps | The practice of managing cloud cost as a shared responsibility between engineering, finance and business. (Chapter 43.) |
| TCO | Total cost of ownership: all costs over time, including people, support and tools, not just the AWS bill. |
5.1 The Predictor's Mindset: Price Times Quantity, and the Five-Step Method#
You do not need to memorize hundreds of prices. You need one method, applied patiently. Any estimate, from a hobby site to a bank migration, follows these five steps.
| Step | What you do | Output | StackCafe example |
|---|---|---|---|
| 1. List the components | Draw the architecture and list every AWS resource in it, including the boring ones (DNS, logs, IP addresses, load balancer) | A component list | 2 web servers, a load balancer, a NAT gateway, a database, a bucket, logs, DNS |
| 2. Find each component's meters | For every component ask: what exactly does AWS count and charge for? | A meter list | Server: instance-hours + disk GB-months. NAT: hours + GB processed |
| 3. Estimate each meter's quantity | Use hours (730), traffic (requests, GB), storage size, growth. Write down every assumption | A quantity table | 730 hours, 50 GB through NAT, 200 GB egress, 50,000 orders |
| 4. Multiply and add | Price × quantity per meter, then sum. Fixed and variable costs separated | A monthly number | $144.74 |
| 5. Stress it | Add hidden costs, a buffer (15 to 20 percent), and low, expected and high scenarios. Compare with a similar system to sanity-check | A range and a cost per unit | $137 to $291, about $0.003 per order |
ARCHITECTURE METERS QUANTITIES PRICE SHEET
(what exists) (what is counted) (how much) (rate each)
+---------------+ +----------------------+ +----------------+ +----------------+
| web servers | ------> | instance-hours | --> | 2 x 730 hours | x | $0.0208 / hour | = $30.37
| NAT gateway | ------> | gateway-hours, GB | --> | 730 h, 50 GB | x | $0.045 / unit | = $35.10
| database | ------> | instance-hours, GB | --> | 2 x 730 h, 40GB| x | rates | = $27.96
| ... | | ... | | ... | | |
+---------------+ +----------------------+ +----------------+ +----------------+
SUM -> monthly estimate -> add buffer -> rangeThree kinds of cost in every estimate#
| Kind | Behavior | Examples | How to predict |
|---|---|---|---|
| Fixed (time-based) | Same every month while the resource exists, whatever the traffic | EC2 instance-hours, NAT gateway hours, load balancer hours, RDS instance, EKS cluster, public IPv4 addresses | Price per hour × 730 × count. Easy and certain |
| Variable (usage-based) | Grows with traffic or data | Requests, GB transferred, GB stored, Lambda GB-seconds, DynamoDB request units, log ingestion | Quantity × price. Needs a usage model, and is where estimates go wrong |
| One-off | Charged once | Upfront payment of a commitment, data migration fees, early-delete fees on some storage classes | List them separately, so they do not distort the monthly run rate |
The predictor's golden rule: estimate the fixed costs exactly (they are just arithmetic), and spend your thinking time on the variable costs (they depend on behavior). Then show how the total moves as traffic moves. A single number is a guess. A range with assumptions is an estimate.
5.2 The Four Pricing Ideas#
AWS describes its pricing philosophy in a few ideas. Learn them as four levers.
| # | Idea | In plain words | Example |
|---|---|---|---|
| 1 | Pay as you go | No upfront payment, no minimum. You pay for what you use, when you use it, and stop paying when you stop | Lambda: nothing runs, nothing is billed |
| 2 | Pay less when you commit | Promise to use a steady amount for 1 or 3 years, and the rate drops | Savings Plans: up to 66 percent (Compute) or 72 percent (EC2 Instance) off On-Demand |
| 3 | Pay less as you use more | Volume tiers: the more you store or transfer, the lower the price per unit | S3 storage and data transfer out both get cheaper per GB at higher volumes |
| 4 | Free tiers | Free credits and allowances to start, plus some permanent monthly allowances | Up to $200 credits on a new account, 1 million Lambda requests a month, 100 GB of egress a month |
You may also hear a fifth idea, "pay for what you reserve", for services such as provisioned DynamoDB capacity or provisioned IOPS: you choose a capacity and pay for it whether you use all of it or not. It is a form of fixed cost, and it is cheaper per unit than pure pay-per-request when usage is steady.
Go DeeperTiered pricing in numbers: S3 storage and internet egress
Tiers are applied to your total monthly usage of a meter, in order. Using US East list prices:
| Meter | Tier | Price per GB |
|---|---|---|
| S3 Standard storage | First 50 TB each month | $0.023 |
| Next 450 TB | $0.022 | |
| Over 500 TB | $0.021 | |
| Data transfer out to the internet (aggregated across services) | First 100 GB each month | Free |
| Next 10 TB | $0.09 | |
| Next 40 TB | $0.085 | |
| Next 100 TB | $0.07 |
Worked example. You send 12,000 GB to the internet in a month. The first 100 GB is free. The next 10,240 GB (10 TB, counting 1 TB as 1,024 GB) costs $0.09 each: 10,240 × 0.09 = $921.60. The remaining 1,660 GB costs $0.085 each: 1,660 × 0.085 = $141.10. Total about $1,062.70. The blended price is about $0.088 per GB, slightly below the headline $0.09. Tier boundaries and free allowances change, so confirm them on the pricing page.
5.3 Meters and Units: What Each Kind of Service Charges For#
The conversions to know by heart#
| Conversion | Value | Use it to |
|---|---|---|
| Hours in a month | 730 (365 × 24 / 12). AWS pricing pages use this average | Hourly price × 730 = monthly price. $0.01 per hour is about $7.30 a month, and $0.10 per hour is $73 |
| Seconds in a month | about 2,630,000 | 1 request per second is about 2.63 million requests a month. 1 MB per second is about 2.63 TB a month |
| GB-month | 1 GB stored for a month | Average the size over the month. 100 GB for half the month is 50 GB-months |
| Lambda GB-second | memory (GB) × duration (s) × invocations | 256 MB, 120 ms, 300,000 calls: 0.25 × 0.12 × 300,000 = 9,000 GB-s |
| 1 TB | 1,024 GB in AWS tier tables | Tier boundaries such as "first 10 TB" |
| Per million / per 1,000 / per 10,000 | Different services quote different units | Always normalize to "per request" before comparing |
The meters of the 15 services you meet most#
| Service | What is metered (the pricing dimensions) | Time-based or usage-based? |
|---|---|---|
| EC2 | Instance-hours by type, OS, Region and purchase option. Plus EBS volumes, snapshots, public IPv4, data transfer | Time-based, plus usage extras |
| Lambda | Requests, and GB-seconds of compute (memory × duration). Optional: provisioned concurrency, extra ephemeral storage | Usage-based |
| ECS or EKS on Fargate | vCPU-hours and GB-hours while tasks run. EKS also charges a cluster fee per hour | Time-based while running |
| S3 | GB-month by storage class, requests (PUT and GET are priced differently), retrieval for cold classes, data transfer out | Usage-based |
| EBS | GB-month by volume type, provisioned IOPS and throughput above the baseline, snapshot GB-month | Time-based (size is reserved) |
| RDS and Aurora | Instance-hours by class and engine, storage GB-month, backups beyond the free amount, I/O (some Aurora modes), data transfer | Time-based, plus usage |
| DynamoDB | On-demand: read and write request units. Provisioned: capacity units per hour. Plus GB-month storage, backups, streams | On-demand usage-based, provisioned time-based |
| ELB (ALB, NLB) | Load-balancer-hours, plus capacity units (LCU or NLCU) for traffic. Plus its public IPv4 addresses | Time-based, plus usage |
| NAT gateway | Gateway-hours, plus GB of data processed. Plus its public IPv4 address | Time-based and usage |
| VPC interface endpoint | Endpoint-hours per AZ, plus GB processed | Time-based and usage |
| API Gateway | Per million requests (the price depends on API type: HTTP API is cheaper than REST API) | Usage-based |
| SQS, SNS, EventBridge | Per million requests, publishes or events | Usage-based |
| CloudFront | GB transferred out and number of requests. A monthly free allowance applies | Usage-based |
| CloudWatch | GB of logs ingested and stored, custom metrics, alarms, dashboards, Logs Insights queries | Usage-based and per item |
| KMS, Secrets Manager, Route 53 | KMS: per key per month, plus per 10,000 requests. Secrets Manager: per secret per month. Route 53: per hosted zone per month, plus per million queries | Mostly time-based and per item |
The teaching price sheet (used by every example in this chapter)#
These are rounded US East (N. Virginia) list prices in US dollars, chosen to make arithmetic easy. In the lab you replace them with live prices for your Region.
| Meter | Teaching price | Monthly equivalent (730 hours) |
|---|---|---|
EC2 t3.small (2 vCPU, 2 GiB), Linux | $0.0208 per hour | $15.18 |
EC2 t3.medium (2 vCPU, 4 GiB), Linux | $0.0416 per hour | $30.37 |
EC2 m6i.large (2 vCPU, 8 GiB), Linux | $0.096 per hour | $70.08 |
EC2 t4g.small (Graviton), Linux | $0.0168 per hour | $12.26 |
| EBS gp3 volume | $0.08 per GB-month | |
| S3 Standard storage | $0.023 per GB-month | 1 TB = $23.55 |
| S3 PUT, POST, LIST requests / GET requests | $0.005 per 1,000 / $0.0004 per 1,000 | |
| NAT gateway | $0.045 per hour + $0.045 per GB processed | $32.85 + usage |
| Application Load Balancer | $0.0225 per hour + $0.008 per LCU-hour | $16.43 + usage |
| Public IPv4 address (any, in use or idle) | $0.005 per hour | $3.65 |
| Data transfer out to the internet | $0.09 per GB (first 100 GB a month free) | |
| Data transfer between AZs in a Region | $0.01 per GB out of the sender plus $0.01 per GB into the receiver | $0.02 per GB in total |
| Data transfer between Regions | $0.02 per GB (from the source Region) | |
| Lambda requests / compute (x86) | $0.20 per million / $0.0000166667 per GB-second | Free: 1M requests and 400,000 GB-s a month |
| API Gateway HTTP API | $1.00 per million requests | |
| DynamoDB on-demand | $0.625 per million writes, $0.125 per million reads (after the AWS price cut of November 2024) | Storage $0.25 per GB-month, first 25 GB free |
RDS db.t4g.micro MySQL, Single-AZ | $0.016 per hour | $11.68 (Multi-AZ doubles it) |
| RDS gp3 storage | $0.115 per GB-month | Multi-AZ doubles the storage |
| Fargate (Linux x86) | $0.04048 per vCPU-hour + $0.004445 per GB-hour | 0.5 vCPU + 1 GB = $18.02 |
| EKS cluster | $0.10 per hour | $73.00 |
| CloudWatch Logs ingestion / alarm | $0.50 per GB / $0.10 per alarm-month | |
| Route 53 hosted zone / queries | $0.50 per month / $0.40 per million |
Mumbai is not N. Virginia. The same service often costs more in ap-south-1. Your estimate must use the Region you will deploy to. The method and the ratios between components stay about the same, which is why the teaching sheet is useful for learning, but a real quote needs real prices.
5.4 Buying Options: On-Demand, Savings Plans, Reserved Instances and Spot#
The same EC2 hour can be bought four ways. The hardware is identical. What changes is your commitment and how much AWS may interrupt you.
| Option | How it works | Discount (up to) | Commitment | Best for |
|---|---|---|---|---|
| On-Demand | Pay the list rate per second (minimum 60 seconds for EC2). Start and stop any time | None | None | New, spiky or unpredictable workloads. Learning |
| Compute Savings Plan | Commit to a dollar amount per hour for 1 or 3 years. The discount applies automatically to EC2 (any family, size, Region, OS), Fargate and Lambda | 66 percent | $ per hour, 1 or 3 years | Steady baseline across changing services. The default recommendation |
| EC2 Instance Savings Plan | Same commitment, but tied to one instance family in one Region. Applies across sizes, AZs and OS | 72 percent | $ per hour, 1 or 3 years, one family and Region | A known, stable family. Maximum discount |
| Reserved Instance (RI) | Commit to a specific instance configuration. Standard RIs give the deepest discount. Convertible RIs can be exchanged | 72 percent | 1 or 3 years | Also used for databases and caches (RDS, ElastiCache and others). Standard RIs can be resold |
| Spot Instance | Use AWS's spare capacity. AWS may reclaim it with a 2-minute warning | 90 percent | None | Stateless, fault-tolerant, flexible work: batch jobs, CI builds, container workers, data processing |
Payment options for Savings Plans and RIs are No upfront (pay monthly, smallest discount), Partial upfront, and All upfront (pay for the term at the start, largest discount). A 3-year term discounts more than 1 year, but it locks you in longer.
Cost per hour of the same compute (index, On-Demand = 100):
On-Demand #################################################### 100
Compute SP 1y ################################## ~70 (illustrative)
EC2 Inst. SP 3y ############## ~28 (illustrative, best case)
Spot ###################### ~30 (varies, can be interrupted)
Cheaper = more commitment, or more tolerance for interruption.Break-even math: when does a commitment win?#
A Savings Plan charges you every hour for the amount you committed, whether you use it or not. So it only wins if you actually use most of what you committed to.
Discount d = 30% -> you pay 70% of the On-Demand rate for the committed hours, used or not.
Break-even utilization u = 1 - d = 70%
If the compute runs MORE than 70% of the hours -> the plan wins
If it runs LESS than 70% of the hours -> On-Demand is cheaper| Scenario | On-Demand cost | With a 30 percent plan | Winner |
|---|---|---|---|
| A server that runs 24 × 7 (100 percent of hours) | $100.00 | $70.00 | Plan saves $30 |
| A server that runs 60 percent of the hours (a dev box on a schedule) | $60.00 | $70.00 | On-Demand saves $10 |
| A server that runs 70 percent of the hours | $70.00 | $70.00 | Tie: the break-even point |
How to buy a plan sensibly: commit only to your steady minimum, which is the usage you are certain to have every hour for the whole term. Cover the spiky part with On-Demand, and the very flexible part with Spot. Review the AWS recommendations in the Billing console (Savings Plans, Recommendations) which are based on your past usage.
Spot in numbers#
m6i.large costs $0.096 per hour On-Demand, or $70.08 a month. If the current Spot price is 70 percent lower, it is $0.0288 per hour, or $21.02 a month. That saves $49.06 a month per instance, and over 10 workers, nearly $500. The catch: your software must survive losing a worker with 2 minutes' notice, by finishing small jobs, saving progress, or being stateless behind a queue. Spot prices are set by supply and demand and change over time.
| Workload | Choose | Why |
|---|---|---|
| A new app with unknown traffic | On-Demand (or serverless) | Do not commit before you know the baseline |
| Production web servers running all year | Compute Savings Plan for the baseline, On-Demand for peaks | Predictable steady cost, flexible |
| A database on RDS that will run for 3 years | Reserved instance for the database engine (check the options for your engine) | Databases are steady and not covered by compute plans |
| Nightly data-processing workers | Spot, with retries | Fault-tolerant, big saving |
| Unpredictable mix of Lambda, Fargate and EC2 | Compute Savings Plan | One commitment covers all three |
| A dev or test environment used 9 to 6 on weekdays | Schedule it off at night (about 36 percent of the hours), not a plan | Switching off beats any discount |
Over-committing. A 3-year plan sized to this month's peak becomes a bill you cannot escape when traffic drops or you move to serverless. Savings Plans cannot be cancelled. Commit to the floor of your usage, not to your hopes.
Go DeeperSavings Plans vs. Reserved Instances: the honest comparison
| Savings Plans | Reserved Instances | |
|---|---|---|
| You commit to | A dollar amount per hour | A specific instance configuration |
| Flexibility | High: the Compute plan follows you across families, sizes, Regions, and even to Fargate and Lambda | Lower: Standard RIs are tied to attributes. Convertible RIs can be exchanged |
| Maximum discount | 66 percent (Compute) or 72 percent (EC2 Instance) | 72 percent (Standard) |
| Covers databases | The classic plans cover compute. Check the Savings Plans page for newer plan types | Yes, for services such as RDS and ElastiCache |
| Can be sold on if unneeded | No | Standard RIs can be sold in the RI Marketplace |
| Recommendation | Default for EC2, Fargate and Lambda | Use for databases and other services that have RIs |
5.5 The Hidden Costs: Where Beginners' Estimates Break#
Almost every beginner estimate lists the servers and the database and forgets the supporting cast. In the three-tier example you will price in section 5.6, the servers are about 23 percent of the bill. Networking is about 55 percent. Learn these.
| Hidden cost | How it is charged (teaching prices) | Monthly if forgotten | How to avoid or reduce it |
|---|---|---|---|
| NAT gateway | $0.045 per hour + $0.045 per GB processed. You need one per AZ for resilience | $32.85 for one, $98.55 for three, before data and IP | Use VPC gateway endpoints for S3 and DynamoDB (free), put only what needs internet behind NAT, share one NAT in dev |
| Public IPv4 addresses | $0.005 per hour for every public IPv4 address, in use or not, including the ones on load balancers and NAT gateways | $3.65 each | Use IPv6 where possible, release unused Elastic IPs, reduce public-facing resources |
| Load balancers | Hourly fee + LCU usage + the IPv4 address in each AZ it uses | About $22 to $30 for a small ALB | Share one ALB across many services with path and host rules |
| Data transfer out to the internet | $0.09 per GB after the free allowance | $83 per TB | CloudFront in front (the first 1 TB a month is free, and origin to CloudFront is free), compress responses |
| Cross-AZ traffic | $0.01 out + $0.01 in, so $0.02 per GB | $20 per TB | Keep chatty services in the same AZ where safe, use zone-aware routing |
| Cross-Region traffic | About $0.02 per GB | $20 per TB | Replicate only what you need |
| CloudWatch Logs | $0.50 per GB ingested, plus storage | Often the largest cost of a tiny serverless app | Log less, use levels, set retention, filter before ingest |
| Idle and over-sized compute | You pay the same for a 3 percent busy server | The server price, wasted | Right-size with Compute Optimizer, schedule dev off, use auto scaling |
| Orphaned storage | Unattached EBS volumes and old snapshots, S3 versions and incomplete multipart uploads | $8 for a forgotten 100 GB volume | Lifecycle rules, snapshot policies, tagging, cleanup (Chapter 4) |
| Multi-AZ doubling | RDS Multi-AZ doubles instance and storage cost | Doubles the database line | Right and necessary for production. Single-AZ for dev |
| Support plan | Paid plans are a percentage of monthly usage with a minimum. Basic is free | Varies | Choose Basic for learning. Check current plan prices before production |
| Tax and currency | Estimates exclude tax. In India, bills may come from AWS India in rupees with 18 percent GST added | About 18 percent on top | Add tax and the exchange rate to your quote for Indian customers |
"Data transfer in is free, so I will not worry." True for data coming into AWS from the internet. But data out, data between AZs, data between Regions, and data processed by NAT gateways and endpoints are all charged. Move data carefully: a design that copies 5 TB a month between AZs pays $100 for the privilege.
Forgotten for a month (teaching prices): an EKS cluster $73.00. An m6i.large instance $70.08. A NAT gateway with its IP $36.50. A small ALB with usage about $22. 1 TB in S3 Standard $23.55. A single-AZ db.t4g.micro $11.68. A 100 GB gp3 volume $8.00. A public IPv4 address $3.65. None of these is large alone. A lab with six of them running for a month costs more than a pizza dinner for a team.
5.6 Worked Estimates: Serverless StackCafe vs. Three-Tier StackCafe#
Now the real practice. StackCafe's ordering website, version 1, has 50,000 orders a month. We price it two ways, with the teaching price sheet, and compare.
Step 1 and 3: the usage model#
| Assumption | Value |
|---|---|
| Orders per month | 50,000 |
| API calls per order (browse, cart, pay, status, and so on) | 6, so 300,000 calls a month |
| Page views per month, and page weight | 300,000 views × 1.5 MB, about 450 GB of delivered content |
| Database writes and reads per order | 3 writes and 5 reads, in request units |
| Log volume | About 2 GB a month for serverless, 5 GB for servers |
Estimate A: serverless (S3, CloudFront, API Gateway, Lambda, DynamoDB)#
| Component and meter | Quantity × price | Monthly cost |
|---|---|---|
| S3 storage | 2 GB × $0.023 | $0.05 |
| S3 GET requests (cache misses) | 100,000 × $0.0004 per 1,000 | $0.04 |
| CloudFront: 450 GB and about 3 million requests | Inside the monthly free allowance | $0.00 |
| API Gateway HTTP API | 300,000 × $1.00 per million | $0.30 |
| Lambda requests | 300,000 × $0.20 per million | $0.06 |
| Lambda compute | 9,000 GB-s × $0.0000166667 | $0.15 |
| DynamoDB writes | 150,000 × $0.625 per million | $0.09 |
| DynamoDB reads | 250,000 × $0.125 per million | $0.03 |
| Route 53 | 1 zone $0.50 + 1M queries $0.40 | $0.90 |
| CloudWatch Logs | 2 GB × $0.50 | $1.00 |
| Total | about $2.62 (about $2.41 once the Lambda free tier applies) |
Cost per order: $2.62 / 50,000 = about $0.00005, or $0.05 per 1,000 orders. Notice that logs are the biggest line, bigger than the compute that does the real work. That is a classic surprise, and a lever: verbose logging costs more than the code it describes.
Estimate B: classic three-tier on EC2 (Multi-AZ web, NAT, ALB, RDS)#
| Component and meter | Quantity × price | Monthly cost |
|---|---|---|
2 × t3.small web servers | 2 × 730 h × $0.0208 | $30.37 |
| 2 × 20 GB gp3 disks | 40 GB × $0.08 | $3.20 |
| ALB hours | 730 h × $0.0225 | $16.43 |
| ALB capacity (about 1 LCU) | 730 h × $0.008 | $5.84 |
| ALB public IPv4 (2 AZs) | 2 × 730 h × $0.005 | $7.30 |
| NAT gateway hours | 730 h × $0.045 | $32.85 |
| NAT data processed | 50 GB × $0.045 | $2.25 |
| NAT public IPv4 | 730 h × $0.005 | $3.65 |
RDS db.t4g.micro Multi-AZ instance | 2 × 730 h × $0.016 | $23.36 |
| RDS storage, 20 GB, Multi-AZ | 2 × 20 GB × $0.115 | $4.60 |
| Cross-AZ traffic | 100 GB × $0.02 | $2.00 |
| Internet egress | (200 GB − 100 GB free) × $0.09 | $9.00 |
| CloudWatch Logs and 5 alarms | 5 GB × $0.50 + 5 × $0.10 | $3.00 |
| Route 53 | 1 zone + queries | $0.90 |
| Total | $144.74 |
Cost per order: $144.74 / 50,000 = about $0.003, which is 55 times the serverless cost at this volume. Nearly all of B is fixed cost: it costs almost the same whether there are 5,000 or 50,000 orders.
Where the money goes in B#
| Group | Includes | Cost | Share |
|---|---|---|---|
| Networking | ALB, NAT gateway, public IPv4, cross-AZ and egress traffic | $79.32 | 55 percent |
| Compute | Web servers and their disks | $33.57 | 23 percent |
| Database | Multi-AZ RDS instance and storage | $27.96 | 19 percent |
| Observability and DNS | Logs, alarms, Route 53 | $3.90 | 3 percent |
Estimate B, $144.74 a month, where does it go?
Networking ###################################################### 55% (ALB + NAT + IPs + traffic)
Compute ####################### 23% (the servers everyone budgets for)
Database ################### 19%
Logs + DNS ### 3%The crossover: when does the servers option win?#
Serverless has almost no fixed cost and a small cost per order. About $0.95 fixed (DNS and storage) plus about $0.0000327 per order (API, Lambda, DynamoDB and logs per order). The three-tier design costs about $145 a month and, as long as its two small servers can handle the traffic, does not grow with orders.
| Orders per month | Serverless (A model) | Three-tier (B, if capacity is enough) | Cheaper |
|---|---|---|---|
| 10,000 | $1.27 | $144.74 | Serverless, by far |
| 50,000 | $2.58 | $144.74 | Serverless |
| 500,000 | $17.30 | $144.74 | Serverless |
| 2,000,000 | $66.35 | $144.74 | Serverless |
| 5,000,000 | $164.45 | $144.74 | Three-tier starts to win |
| 10,000,000 | $327.95 | More servers needed: maybe $250 to $300 | Three-tier |
The lines cross at about 4.4 million orders a month (that is $144.74 minus $0.95, divided by $0.0000327). Below it serverless is cheaper, above it, always-on servers are cheaper per order, if they can really carry the load, and if you value the operations work you take on. This is the heart of architecture economics: no design is cheapest at every size.
What an architect says to Maya: "At 50,000 orders, serverless costs about $3 a month and the three-tier design about $145. Servers only win above roughly 4 million orders a month, and by then you will have the revenue and the team to move. Start serverless. Do not pay $140 a month for capacity you cannot use yet."
Cutting estimate B by 42 percent, one lever at a time#
| Step | Change | Saving | New total |
|---|---|---|---|
| Start | Estimate B as above | $144.74 | |
| 1 | Graviton: t4g.small ($0.0168) instead of t3.small ($0.0208) | $5.84 | $138.90 |
| 2 | Remove the NAT gateway: the web servers only call S3 and DynamoDB, so use free gateway endpoints. Saves hours, data and IP | $38.75 | $100.15 |
| 3 | Savings Plan at an assumed 30 percent on the remaining web compute ($24.53) | $7.36 | $92.79 |
| 4 | CloudFront in front: the 200 GB leaves through CloudFront, within its free allowance, and origin to CloudFront is free | $9.00 | $83.79 |
Total saving: $60.95, or 42 percent, with no change in what customers see. Step 2 assumes nothing else needs outbound internet access. If it does, interface endpoints or a single shared NAT gateway are the alternatives, and each has its own cost. This is the process of an estimate: change one input, recompute, compare.
"The servers are the bill." In estimate B the two web servers cost $30. A beginner who prices only "2 small servers and a database" would predict about $60 and be surprised by $145. Always walk the entire diagram, arrow by arrow, asking "what meter runs on this?"
5.7 The Tools: Which Question Does Each One Answer?#
| Question | Tool | What it does |
|---|---|---|
| "What will this design cost before I build it?" | AWS Pricing Calculator | A public version at calculator.aws (no sign-in) builds and shares estimates. The version inside the Billing console adds workload estimates (including from your historical usage) and bill estimates that model commitments and discounts. It is also available through an API |
| "What is the exact live price of this meter in this Region?" | Price List API (bulk files and aws pricing get-products) | Machine-readable prices for every service, Region and term. Use it to feed a spreadsheet or script |
| "What did I spend, on what, and why did it change?" | Cost Explorer | Charts by service, Region, usage type, tag and day. Forecasts the month. Savings Plans and RI recommendations and utilization reports |
| "Warn me before I overspend." | AWS Budgets | Alerts on cost, usage, and Savings Plan coverage. Optional actions (Chapter 4) |
| "Something odd just happened. What?" | Cost Anomaly Detection | Learns your pattern and flags sudden jumps |
| "Show me every line item, to analyze with SQL." | Data Exports (Cost and Usage Report) | The most detailed billing data, delivered to S3 and queried with Athena |
| "Which servers are too big or idle?" | Compute Optimizer and Trusted Advisor | Right-sizing and idle-resource recommendations |
| "Who owns this cost?" | Cost allocation tags and Cost Categories | Group spend by team, project or environment |
| "What is still free for me?" | Free Tier usage page | Your remaining credits and allowances |
Using the Pricing Calculator well#
- Set the Region first and create one estimate per environment (dev, test, production).
- Add services one by one from your component list. Do not stop at the servers. Add NAT gateways, load balancers, data transfer, logs and DNS.
- Fill in honest usage numbers (hours per month, GB, requests). The calculator is only as good as your quantities.
- Choose the purchase option (On-Demand or Savings Plan) for each compute line, and compare both.
- Name each service line clearly, save the estimate, and share the link or export it, so a reviewer can see your assumptions.
Fetching a live price with the CLI#
Run this in CloudShell. The pricing API lives in a few Regions (use us-east-1), and you need permission pricing:GetProducts (administrators have it).
aws pricing get-products --region us-east-1 --service-code AmazonEC2 \
--filters \
Type=TERM_MATCH,Field=instanceType,Value=t3.small \
Type=TERM_MATCH,Field=location,Value="Asia Pacific (Mumbai)" \
Type=TERM_MATCH,Field=operatingSystem,Value=Linux \
Type=TERM_MATCH,Field=tenancy,Value=Shared \
Type=TERM_MATCH,Field=preInstalledSw,Value=NA \
Type=TERM_MATCH,Field=capacitystatus,Value=Used \
--query 'PriceList[0]' --output text \
| jq -r '.terms.OnDemand | to_entries[0].value.priceDimensions | to_entries[0].value.pricePerUnit.USD'The answer is the On-Demand price per hour for a t3.small in Mumbai. Each filter narrows the search: without the last four, you get many products (other operating systems, dedicated tenancy, and so on).
Billing is not instant. Cost Explorer data is typically updated at least once a day, and the final invoice is issued after the month ends. For a quick check of "what is running now", use the console lists and the sweep script from Chapter 4. For "what did it cost", use Cost Explorer a day later.
Go DeeperCost and Usage Report (Data Exports) in one minute
The Cost and Usage Report is the raw material of every cost tool. Each row is one line of usage: service, usage type, Region, resource ID, tags, quantity, rate and cost, by the hour or by the day. You create an export in Billing and Cost Management, Data Exports, choose an S3 bucket and file format, and AWS delivers updated files. Then you query it with Athena (Chapter 32) using SQL, for example "top ten resources by cost this month, by tag". Teams use it for showback reports, anomaly hunting and custom dashboards. You do not need it for a small account, but you should know it exists for the day Cost Explorer's screens cannot answer your question.
5.8 The Predictor's Toolkit: Scenarios, Buffers, Unit Economics and Growth#
Always give a range#
The right way to present an estimate is three numbers, with the assumptions that separate them.
| Scenario | Traffic factor | Total (estimate B) | Cost per order |
|---|---|---|---|
| Low | 0.5 × | $136.62 | $0.00546 |
| Expected | 1 × | $144.74 | $0.00289 |
| High | 3 × | $177.24 | $0.00118 |
| Viral | 10 × | $290.99 | $0.00058 |
The calculation: only the variable lines (NAT data, cross-AZ, egress, logs) scale with traffic, while the fixed lines stay the same. The table shows two useful facts. First, a design with high fixed costs has a cost per order that falls as traffic rises. Second, the "viral" row assumes the two small servers still cope. In reality a 10 × spike would need more servers or auto scaling, and your estimate for that scenario must include them.
Add a buffer, and say why#
- 15 to 20 percent for things you will forget (a missing meter, a log line that grows, a test environment).
- Tax and currency for the customer's invoice.
- Growth over the planning period: ask "what will the traffic be in 6 and 12 months?" and price those months too.
Unit economics: the number the business cares about#
A CFO does not care that the bill is $145. They care that each order costs $0.003 to serve while it earns $2.00 of gross margin, or that a serverless version costs $0.00005. Express every estimate as cost per unit of business value: per order, per active user, per 1,000 requests, per GB processed, per document. That number lets you compare designs fairly, set pricing, and spot trouble when it rises.
cost per order = total monthly cost / orders per month
gross margin = revenue per order - cost per order - other variable costs
Watch the trend: if cost per order rises while orders rise, something scales badly.Forecast growth#
- Separate the cost into fixed and variable parts (the estimator script below does this).
- Model traffic growth (for example 15 percent a month). Variable costs grow with it. Fixed costs move in steps when you add servers.
- Mark the points where the design must change (the crossover, a database that needs a bigger class, a Region launch).
- Compare the forecast with Cost Explorer's own forecast each month, and correct your assumptions.
A tiny estimator you can reuse (Python)#
Spreadsheets are fine. A script is repeatable and can read live prices. This one reproduces estimate B. Change the numbers in price to your Region's rates and run it in CloudShell or on your laptop.
HOURS = 730 # AWS uses 730 hours as an average month
ORDERS = 50_000 # orders per month in the "expected" case
# 1. PRICE SHEET (USD). Replace each number with the live price for your Region.
price = {
"t3.small_hr": 0.0208, "ebs_gb_month": 0.08,
"alb_hr": 0.0225, "lcu_hr": 0.008, "ipv4_hr": 0.005,
"nat_hr": 0.045, "nat_gb": 0.045,
"rds_t4g.micro_hr": 0.016, "rds_gp3_gb_month": 0.115,
"xaz_gb": 0.02, "egress_gb": 0.09, "free_egress_gb": 100,
"logs_ingest_gb": 0.50, "alarm_month": 0.10, "r53_zone_month": 0.50,
}
# 2. USAGE MODEL + 3. COST LINES: (name, monthly cost, "fixed" or "variable")
p = price
lines = [
("2 x t3.small web servers", 2 * HOURS * p["t3.small_hr"], "fixed"),
("2 x 20 GB web disks", 2 * 20 * p["ebs_gb_month"], "fixed"),
("Load balancer (hours + 1 LCU)", HOURS * (p["alb_hr"] + p["lcu_hr"]), "fixed"),
("Load balancer public IPv4 x2", 2 * HOURS * p["ipv4_hr"], "fixed"),
("NAT gateway hours + its IPv4", HOURS * (p["nat_hr"] + p["ipv4_hr"]), "fixed"),
("NAT data processed (50 GB)", 50 * p["nat_gb"], "variable"),
("RDS Multi-AZ instance", 2 * HOURS * p["rds_t4g.micro_hr"], "fixed"),
("RDS Multi-AZ storage (20 GB)", 2 * 20 * p["rds_gp3_gb_month"], "fixed"),
("Cross-AZ traffic (100 GB)", 100 * p["xaz_gb"], "variable"),
("Internet egress (200 GB)", max(0, 200 - p["free_egress_gb"]) * p["egress_gb"], "variable"),
("Logs (5 GB) + 5 alarms", 5 * p["logs_ingest_gb"] + 5 * p["alarm_month"], "variable"),
("Route 53 zone + queries", p["r53_zone_month"] + 0.40, "fixed"),
]
fixed = sum(c for _, c, k in lines if k == "fixed")
variable = sum(c for _, c, k in lines if k == "variable")
print(f"{'Line':40s} {'USD/month':>10s}")
for name, cost, kind in lines:
print(f"{name:40s} {cost:10.2f} ({kind})")
print(f"{'TOTAL (expected)':40s} {fixed + variable:10.2f}\n")
# 4. SCENARIOS: traffic changes only the variable lines
for label, f in [("low (0.5x traffic)", 0.5), ("expected (1x)", 1), ("high (3x)", 3), ("viral (10x)", 10)]:
total = fixed + variable * f
print(f"{label:22s} total ${total:8.2f} per order ${total / (ORDERS * f):.5f}")Twelve cost levers, ranked by how often they pay#
| # | Lever | Typical effect | Effort |
|---|---|---|---|
| 1 | Delete or switch off what is idle (dev at night, forgotten resources) | Often the biggest saving | Low |
| 2 | Right-size servers and databases using real utilization | 20 to 50 percent of compute | Low |
| 3 | Choose Graviton (ARM) where software supports it | About 20 percent | Low to medium |
| 4 | Savings Plans for the steady baseline | Up to 66 to 72 percent on covered compute | Low |
| 5 | Spot for fault-tolerant work | Up to 90 percent | Medium |
| 6 | Serverless for spiky or small workloads | Large when traffic is low | Medium |
| 7 | VPC gateway endpoints for S3 and DynamoDB (free) instead of NAT traffic | Removes NAT data charges | Low |
| 8 | CloudFront for content and egress | Cuts internet egress, speeds up users | Medium |
| 9 | S3 lifecycle rules and storage classes (Standard-IA, Glacier tiers) | Up to 80 percent on cold data | Low |
| 10 | Log less, keep less (levels, retention, sampling) | Cuts CloudWatch costs | Low |
| 11 | Keep traffic local (same AZ where safe, same Region) | Cuts transfer charges | Medium |
| 12 | Tag, report, review monthly (FinOps habit) | Prevents regressions | Low |
The estimate checklist: (1) every box in the diagram has a line. (2) Every line shows its meters. (3) Region is the real one. (4) Hours are 730. (5) NAT, ALB, IPv4, egress, cross-AZ, logs and DNS are included. (6) Free tier is applied only where it truly applies. (7) Fixed and variable are separated. (8) A range and a cost per unit are given. (9) Tax and a buffer are added. (10) Assumptions are written next to the number.
Architect Decisions: Pricing-Aware Design#
| If you see... | Choose | Why |
|---|---|---|
| Unknown or tiny traffic | Serverless and pay-per-use services | Near-zero fixed cost, scale to zero |
| Steady, predictable 24/7 baseline | Savings Plan for the floor | Large discount, small risk |
| Batch or fault-tolerant jobs | Spot | Up to 90 percent off |
| A private subnet reading S3 or DynamoDB | Gateway endpoints, not NAT | Free, and removes NAT data charges |
| Global users downloading content | CloudFront | Lower egress, lower latency |
| Dev and test environments | Single-AZ, small sizes, scheduled shutdown | Resilience is not worth paying for there |
| Production data stores | Multi-AZ, accept the doubling | Availability is a requirement |
| Many small services needing HTTP front ends | One shared ALB with rules | Hourly cost shared |
| Cost must be attributed to teams | Mandatory tags plus cost allocation tags | You cannot manage what you cannot attribute |
Traps: Mistakes That Cost Marks and Money#
Pricing only the compute. The servers are often under a quarter of the bill. Walk every arrow and meter: NAT, load balancer, IPv4 addresses, data transfer, logs, DNS, backups.
Forgetting that "stopped" still costs. A stopped EC2 instance does not bill for compute but still bills for its EBS disk and any Elastic IP. A "stopped" RDS instance restarts itself after about 7 days.
Believing a Savings Plan covers everything. Savings Plans discount eligible compute. They do not discount your NAT gateway, your load balancer, your data transfer or most databases. Your bill after a plan still has all the other lines.
Using the wrong unit. One service quotes per 1,000 requests, another per million, another per GB-second. Convert everything to the same unit before comparing, and double-check the factor of 1,000.
Trusting a forecast for a spiky workload. A forecast built from calm days under-predicts a launch week. Build the high scenario deliberately and ask the business about promotions and seasons.
Cost and security are linked. A sudden bill spike is often the first sign of a compromised key (cryptocurrency mining in an unused Region). Cost Anomaly Detection and a billing alert are a security control too. Chapters 8 and 39 show how to restrict Regions and detect misuse.
5.9 Hands-on Lab: Price an Architecture Two Ways#
Time: 40 minutes. Cost: $0, because you only estimate and build nothing. You need: a web browser, and the account from Chapter 4 for Steps 4 to 6.
Step 1. Do the arithmetic by hand first#
On paper, with the teaching price sheet, calculate the monthly cost of: (a) one t3.medium, (b) one NAT gateway with 100 GB processed, (c) 500 GB of S3 Standard, (d) a single-AZ db.t4g.micro with 50 GB gp3 storage, (e) 1 TB of egress.
Show the answers
(a) 0.0416 × 730 = $30.37. (b) 0.045 × 730 = 32.85, plus 100 × 0.045 = 4.50, so $37.35 (add $3.65 for its IPv4 address for $41.00). (c) 500 × 0.023 = $11.50. (d) 0.016 × 730 = 11.68, plus 50 × 0.115 = 5.75, so $17.43. (e) (1,024 − 100 free) × 0.09 = $83.16.
Step 2. Build estimate B in the Pricing Calculator#
- Open
calculator.awsand choose Create estimate. (If you prefer, use Billing and Cost Management, Pricing Calculator in the console.) - Add Amazon EC2: Region Asia Pacific (Mumbai), Linux,
t3.small, quantity 2, 100 percent utilization, On-Demand. Add 2 × 20 GB gp3 storage. - Add Elastic Load Balancing (Application Load Balancer, 1 load balancer, a few GB per hour processed).
- Add NAT Gateway (under Amazon VPC): 1 gateway, 50 GB per month. Add the public IPv4 addresses.
- Add Amazon RDS for MySQL:
db.t4g.micro, Multi-AZ, 20 GB gp3. - Add Data Transfer (200 GB out, 100 GB between AZs), CloudWatch (5 GB logs, 5 alarms) and Route 53 (one hosted zone).
- Save the estimate and note the monthly total.
Step 3. Compare with the teaching result#
Your Mumbai total will not equal $144.74. Write down by what percentage it differs, and which line differs most. That is your Region factor, and it is a real finding, not an error.
Step 4. Fetch a live price with the Price List API#
Open CloudShell (Mumbai) and run the CLI command from section 5.7. Compare the hourly price you get with the calculator's, and with the teaching $0.0208.
Step 5. Feed live prices into the estimator#
Copy the estimator script from section 5.8 into a file named estimate.py in CloudShell. Replace t3.small_hr with your live price, and rerun it. If you want to go further, replace the hard-coded number with a function that calls the Price List API:
import boto3, json
pricing = boto3.client("pricing", region_name="us-east-1")
def ec2_hourly(instance_type, location="Asia Pacific (Mumbai)"):
resp = pricing.get_products(
ServiceCode="AmazonEC2",
Filters=[
{"Type": "TERM_MATCH", "Field": "instanceType", "Value": instance_type},
{"Type": "TERM_MATCH", "Field": "location", "Value": location},
{"Type": "TERM_MATCH", "Field": "operatingSystem", "Value": "Linux"},
{"Type": "TERM_MATCH", "Field": "tenancy", "Value": "Shared"},
{"Type": "TERM_MATCH", "Field": "preInstalledSw", "Value": "NA"},
{"Type": "TERM_MATCH", "Field": "capacitystatus", "Value": "Used"},
],
)
item = json.loads(resp["PriceList"][0])
term = next(iter(item["terms"]["OnDemand"].values()))
dim = next(iter(term["priceDimensions"].values()))
return float(dim["pricePerUnit"]["USD"])
print(ec2_hourly("t3.small"))Step 6. Find three savings and write the quote#
- In the calculator, apply the levers from 5.6: switch the web servers to
t4g.small, remove the NAT gateway, and compare a 1-year Compute Savings Plan option. Record the new total. - Price the serverless version (estimate A) for Mumbai in the same way.
- Write a six-line quote: low, expected and high totals; cost per order; the three biggest lines; the crossover volume; the assumptions; and "tax and exchange rate excluded".
What you should see
Your Mumbai total for estimate B is likely a bit above $144.74, with the difference mostly in compute, the NAT gateway and data transfer. The serverless estimate should stay in single or low double digits for 50,000 orders, with CloudWatch Logs as its biggest line. After the three savings, B should fall by roughly 40 percent. Exact figures depend on the live prices, and that is the point: your method works for any Region.
Cleanup: nothing to delete in AWS. You only created calculator estimates. You may keep them as a reference.
Cheat Sheet#
| Topic | Remember |
|---|---|
| Bill formula | Sum over meters of (price × quantity). Separate fixed (hourly) from variable (usage) |
| Month | 730 hours. Hourly × 730 = monthly. 1 request/sec = 2.63M a month. 1 MB/s = 2.63 TB a month |
| Four ideas | Pay as you go, commit for less, volume tiers, free tiers |
| Compute Savings Plan | Up to 66 percent. EC2, Fargate, Lambda. Flexible |
| EC2 Instance Savings Plan / Standard RI | Up to 72 percent. Tied to a family and Region |
| Spot | Up to 90 percent off, 2-minute interruption notice. Fault-tolerant work only |
| Break-even | Plan wins if utilization is above (1 minus discount) |
| Hidden | NAT (hours + GB, one per AZ), IPv4 ($0.005/h each), ALB, egress, cross-AZ ($0.02/GB), logs, support, tax |
| Free | Data in from the internet. S3 gateway and DynamoDB gateway endpoints. Origin to CloudFront |
| Tools | Calculator (before), Price List API (live price), Cost Explorer (after), Budgets (warn), Data Exports (detail) |
| Always | Region, range, cost per unit, assumptions, buffer, tax |
METHOD list components > find meters > estimate quantities > multiply and sum > add hidden + buffer > range
MONTHLY hourly price x 730 | request/s x 2.63M | MB/s x 2.63 TB | GB-month = size x fraction of month
NUMBERS t3.small $15.18 m6i.large $70.08 NAT $32.85 ALB $16.43 EKS $73.00 IPv4 $3.65 (teaching prices)
SERVERLESS A 50k orders = about $2.6/month ($0.00005 per order) biggest line: logs
THREE-TIER B 50k orders = $144.74/month ($0.003 per order) 55% networking, 23% compute
CROSSOVER about 4.4M orders/month, above that always-on servers win per order
LEVERS idle off | right-size | Graviton | Savings Plan | Spot | serverless | endpoints | CloudFront | lifecycle | logs | local traffic | tagsQuick Recap#
- An AWS bill is a sum of price × quantity over meters. Learn each service's meters.
- Estimate with five steps: components, meters, quantities, multiply and sum, stress with hidden costs and a range.
- A month is 730 hours. Hourly resources are fixed costs. Requests, bytes and compute time are variable costs.
- The four pricing ideas: pay as you go, commit for less, volume tiers, free tiers.
- Savings Plans discount steady compute (66 or 72 percent), Spot discounts interruptible work (up to 90 percent), and a commitment wins only above its break-even utilization.
- Hidden costs (NAT, IPv4, load balancers, egress, cross-AZ, logs) are often more than the servers.
- Serverless wins at low or spiky volume, always-on servers win at high steady volume. Find the crossover.
- Use the Pricing Calculator and Price List API before building, Cost Explorer and Budgets after.
- Always present a range, a cost per unit, your assumptions and the Region.
Practice Section A: Certification-Style Scenarios (10)#
Click Show answer to reveal each answer. Try before you open it. Aim for 9 or more.
Q1. A startup wants no upfront cost and to pay only for the compute it uses, scaling to zero when idle. Which AWS pricing principle best describes this?
A. Pay as you go
B. Reserved capacity
C. Volume tiers
D. Dedicated hardware
Show answer
A. Pay-as-you-go means no upfront commitment and charges only for usage, for example with Lambda.
Q2. A company runs a steady mix of EC2, Fargate and Lambda and may change instance families next year. Which commitment fits best?
A. Standard Reserved Instances
B. EC2 Instance Savings Plan
C. Compute Savings Plan
D. Spot Instances only
Show answer
C. A Compute Savings Plan applies across EC2 (any family, size, Region), Fargate and Lambda. The other options are tied to one family or are not commitments.
Q3. A data-processing job can be interrupted and restarted without harm. Which purchase option gives the lowest cost?
A. On-Demand
B. Spot Instances
C. Dedicated Hosts
D. A 3-year Standard Reserved Instance
Show answer
B. Spot offers up to 90 percent off for interruptible, fault-tolerant work.
Q4. Which data transfer is generally free of charge?
A. Data transferred out from EC2 to the internet
B. Data transferred between Regions
C. Data transferred in from the internet to AWS
D. Data processed by a NAT gateway
Show answer
C. Inbound data from the internet is free. Egress, inter-Region traffic and NAT processing are charged.
Q5. A team deletes all EC2 instances after a lab, but the next bill still shows charges for networking. Which resource is the most likely cause?
A. A running NAT gateway
B. An IAM user
C. A security group
D. A route table
Show answer
A. A NAT gateway is charged per hour and per GB processed, whether or not instances exist. IAM users, security groups and route tables are free.
Q6. Before building a new architecture, an architect wants a cost estimate. Which tool should be used?
A. AWS Cost Explorer
B. AWS Pricing Calculator
C. AWS CloudTrail
D. AWS Config
Show answer
B. The Pricing Calculator estimates cost for planned architectures. Cost Explorer analyzes costs you have already incurred.
Q7. Finance needs a report of AWS spend per project. What is the recommended approach?
A. Create one account per developer
B. Tag resources with a Project tag and activate it as a cost allocation tag
C. Use bigger instances
D. Disable Cost Explorer
Show answer
B. Cost allocation tags group spend in Cost Explorer and reports. Remember to activate the tag in the Billing console.
Q8. A database server will run 24 hours a day for three years on a known EC2 family in one Region. Which option gives the highest EC2 discount?
A. On-Demand
B. Compute Savings Plan, 1 year
C. EC2 Instance Savings Plan or Standard RI, 3 years
D. Spot
Show answer
C. A 3-year EC2 Instance Savings Plan or Standard RI gives the deepest discount (up to 72 percent) for a stable, known configuration. Spot is not suitable for a database that must not be interrupted.
Q9. Which of the following is not a billing dimension of AWS Lambda?
A. Number of requests
B. Duration multiplied by memory (GB-seconds)
C. Number of Availability Zones used
D. Provisioned concurrency, if enabled
Show answer
C. Lambda bills for requests and GB-seconds (plus options such as provisioned concurrency). The number of AZs is not a billing meter.
Q10. One EC2 instance costs $0.0208 per hour and runs the whole month (730 hours). What is the approximate monthly compute cost?
A. $1.52
B. $15.18
C. $151.84
D. $20.80
Show answer
B. 0.0208 × 730 = $15.18.
Practice Section B: Interview and Solution Design Questions (10)#
There is no single multiple-choice answer. Say your answer out loud first, then open the model answer. Interviewers care about clear reasoning and trade-offs.
I1. Walk me through how you would estimate the monthly cost of a new web application.
Show model answer
I draw the architecture and list every component, including supporting ones such as the load balancer, NAT gateway, IP addresses, DNS and logs. For each I identify the meters: hours, GB, requests, GB-seconds. I estimate quantities from a usage model (users, requests per user, size per request, 730 hours a month) and write down every assumption. I multiply by Region-specific prices from the Pricing Calculator or Price List API, sum the lines, separate fixed from variable costs, add data transfer and a buffer, and present low, expected and high scenarios with a cost per unit. Then I sanity-check against a similar system.
I2. A junior predicts $60 for "two small servers and a database", but the real bill is $145. What did they miss?
Show model answer
The supporting networking and operations costs: the Application Load Balancer (hours, capacity and its IPv4 addresses), a NAT gateway (hours, data processed and its IP), cross-AZ and internet data transfer, Multi-AZ doubling of the database, logs and alarms, DNS. In a small design, networking can be over half of the bill, and the servers under a quarter. The lesson is to walk every arrow of the diagram and ask what meter runs there.
I3. When would you recommend a Savings Plan, a Reserved Instance, or Spot?
Show model answer
A Compute Savings Plan for the steady baseline of EC2, Fargate and Lambda where the instance mix may change. An EC2 Instance Savings Plan or Standard RI when the family and Region are known and stable, and a reserved option for databases and caches that have them. Spot for stateless, fault-tolerant or batch work that can handle a 2-minute interruption. On-Demand for new, spiky or unknown workloads. In every case I commit only to the floor of usage that is certain for the whole term.
I4. A Savings Plan gives a 28 percent discount. What is the break-even utilization, and what does it mean in practice?
Show model answer
You pay 72 percent of the On-Demand rate for the committed hours whether you use them or not. The plan wins if the covered compute runs more than 72 percent of the hours (1 minus 0.28). For a 24 × 7 production server it clearly wins. For a dev machine used 40 percent of the time it loses, so scheduling it off or using On-Demand is better. I would also size the commitment to the guaranteed minimum, not to the average.
I5. How would you forecast cost as the user base grows ten times?
Show model answer
I split the bill into fixed and variable parts. Variable costs (requests, data, logs, per-request compute) grow with traffic, so I multiply them by the growth factor. Fixed costs grow in steps when capacity is added: another instance, a larger database class, a second Region. I mark the capacity limits where steps occur, apply expected discounts (commitments, volume tiers), and express the result as cost per user. I compare with Cost Explorer's forecast monthly and refine the assumptions.
I6. Your estimate was $145, but the first bill is $210. List the likely reasons and how you check them.
Show model answer
Candidates: traffic higher than assumed (egress, NAT data, logs), data transfer between AZs or Regions that I did not model, a missing component (extra NAT gateways per AZ, IPv4 addresses, a second environment), over-sized or always-on resources, backups and snapshots, and tax or Region price differences. I use Cost Explorer grouped by service, usage type and tag to find which line differs from the estimate, then correct either the architecture or the assumption, and record what I learned for the next estimate.
I7. Serverless or EC2 for a new product, purely on cost?
Show model answer
It depends on volume and shape. Serverless has almost no fixed cost, so it wins at low or spiky traffic. EC2 or containers have a higher fixed cost but a lower cost per request at high, steady volume, especially with commitments. I model both with the same traffic assumptions, find the crossover (in our example about 4 million orders a month), and include operations effort. For a new product with unknown traffic I recommend starting serverless and revisiting at a defined volume.
I8. How do you estimate data transfer costs when you do not know the traffic?
Show model answer
I model it from the user behavior: users × sessions × pages × page size for egress, and service-to-service calls × payload size for internal traffic, separating internet, cross-AZ and cross-Region flows because each has a different price. I then apply tiers and free allowances, and produce low, expected and high values. I also look for ways to reduce it in the design: CloudFront for content, gateway endpoints instead of NAT for AWS services, and keeping chatty services within an AZ where the resilience requirement allows.
I9. Explain unit economics to a non-technical executive.
Show model answer
Instead of "our AWS bill is $145 a month", we say "each order costs us about three-tenths of a cent to process, and each order earns us a much larger margin". That lets us see whether growth is healthy: if orders double and the bill doubles, the cost per order is steady. If the bill grows faster than orders, something scales badly. It also lets us compare designs fairly, set prices, and show that a change, such as moving to serverless, lowers the cost per order.
I10. You are quoting an Indian customer for a Mumbai deployment. What do you check beyond the Calculator total?
Show model answer
That the estimate uses the Mumbai Region prices and the correct purchase options. That the bill will come from the Indian AWS entity with 18 percent GST and an exchange rate, which the calculator excludes. Support plan costs, data transfer to users, the customer's expected growth, and any commitments or credits. I would present low, expected and high figures in rupees with the assumptions, and recommend a monthly review using Cost Explorer and budgets.
Next up: Chapter 6. IAM: Who Can Do What (users, groups, roles and policies explained with a building-security analogy, how AWS decides allow or deny, temporary credentials, and how to apply least privilege).