Sub topic 1
Why compute is over-provisioned and what you pay for
Prerequisites
This chapter assumes you know the following:
- Basic EC2 concepts: instances, instance types, and AMIs.
- The AWS CLI and the AWS console.
- What a CloudWatch metric is.
- Basic Linux command line and Docker usage (needed in later chapters).
You do not need any Graviton or Arm64 knowledge yet.
Why compute ends up over-provisioned
Most teams pick an instance size once, at launch, using a guess. Nobody has real traffic data yet, so the guess is large. The instance then runs for months or years, and nobody revisits it.
Common causes:
- Fear of outages. Sizing for the worst imaginable peak feels safer than sizing for the typical load.
- Lift-and-shift. A migrated server gets the same vCPU and memory as the old physical machine, which was itself bought with years of growth in mind.
- Copied templates. A launch template or Terraform module with
m5.2xlargegets reused for services that need a fraction of that. - Drift in the workload. A service is optimized, traffic moves, or a feature is retired, but the instance size stays.
- No owner. Cost sits in a shared account, so no one is accountable for it.
The result is paid-for capacity that sits idle. Right-sizing is the practice of matching instance size and type to what the workload actually uses.
What you pay for on EC2
An EC2 bill is more than the hourly instance price. Knowing each part tells you where savings come from.
| Cost driver | What it depends on | Does right-sizing affect it? |
|---|---|---|
| Instance hours | Instance type, size, Region, operating system, purchase option | Yes, directly |
| EBS volumes | Provisioned size, volume type, IOPS and throughput, snapshots | Partly, if volumes were sized to match the instance |
| Data transfer | Traffic leaving the Region, crossing Availability Zones, or going to the internet | Rarely |
| Load balancers, NAT gateways | Hours running plus data processed | No |
| Licenses | Per-vCPU software and some operating systems | Yes, fewer vCPUs can mean lower license cost |
You pay for provisioned capacity, not used capacity. An instance idling at 5% CPU costs the same per hour as one running at 80%. That fact is the basis of everything in this tutorial.
Two levers follow from it:
- Size and family. Pick a smaller size, or a family whose vCPU-to-memory ratio fits the workload.
- Price per unit of work. Pick a processor that does the same work for less money. AWS Graviton is the main example, and later chapters cover it.
A third lever, commitment pricing such as Savings Plans, lowers the hourly rate. It comes last, for reasons covered in the final chapter.
A worked example
Suppose a web service runs on four instances of one type, sized for a launch-day peak that never repeated. Average CPU is 12% and the daily peak is 30%.
The instance size doubles in vCPU and memory with each step up within a family, and the price roughly doubles too. Dropping from the larger size to the next one down halves the hourly cost per instance while peak CPU would rise from 30% to about 60%. That is still within a safe range for many workloads.
The savings arithmetic is simple. If one instance costs P per hour, four instances cost 4P. After moving to the smaller size, they cost about 2P. Over a 730-hour month, the saving is 2P × 730. Nothing about the application changed. Only the unused headroom went away.
This example is why the first question is always "how much of what I pay for do I actually use?"
Common mistakes at this stage
- Judging by average CPU alone. An instance can average 10% and still spike to 95% every hour. Later chapters cover maximums and percentiles.
- Ignoring memory. CloudWatch does not report memory for EC2 by default. An instance can look idle on CPU while its memory is full.
- Cutting before measuring. Shrinking on instinct trades a cost problem for an availability problem.
- Treating cost as only the instance line. Reducing instance size does not fix a large NAT gateway or cross-AZ transfer bill.
What comes next
You now know what you pay for and why the bill drifts upward. The next chapter shows how to collect real utilization data with CloudWatch, which is the evidence every later decision relies on.
Exercise
An EC2 instance averages 4% CPU and has been running at that level for two months. Its owner says the instance is "free to keep because it's idle." Explain what is wrong with this claim, and name one cost beyond the instance hours that you would also check.
Show answer
EC2 bills for provisioned capacity, not used capacity, so an idle instance costs the same per hour as a busy one. The claim is wrong. You would also check attached EBS volumes (provisioned size, type and IOPS are billed whether or not the data is read), and possibly data transfer or a NAT gateway used by the instance.
Exercise
Four instances cost P per hour each. You move them to the next smaller size in the same family, which costs about half as much. Roughly how much do you save over a 730-hour month, and what must you verify before making the change?
Show answer
About 4 × (P / 2) × 730 = 2P × 730 = 1,460P per month. Before changing, verify from utilization data that peak CPU, memory, network and disk usage would still fit in the smaller size with safe headroom.