Sub topic 1
Why compute is over-provisioned and what you pay for
Most teams pay for more compute than their workloads use. This chapter explains why that happens and which parts of an EC2 bill you can change. It sets up the rest of the tutorial: measuring utilization, right-sizing, and moving suitable workloads to AWS Graviton.
Prerequisites
This chapter assumes you can do the following:
- You know the basic EC2 vocabulary: instances, instance types, AMIs, and the difference between a running and a stopped instance.
- You can run AWS CLI commands and find your way around the AWS console.
- You know that CloudWatch stores metrics such as CPU utilization. You don't need to have configured it yourself.
- You can use a Linux shell and have run Docker commands.
The price figures below are illustrative on-demand numbers for the us-east-1 Region. Prices change and differ by Region, so check the current AWS pricing pages before you make decisions.
What over-provisioned means
An instance is over-provisioned when it has more vCPU, memory, network or storage capacity than the workload needs, including its normal peaks. You pay for the capacity you reserve, not for the capacity you use. An EC2 instance costs the same per hour at 3% CPU as at 90% CPU.
A fleet can be over-provisioned in two ways:
- Too large. The instance size is bigger than needed. A workload that peaks at 20% CPU and uses a quarter of its memory could run on an instance half the size.
- Wrong shape. The size is acceptable, but the family is not. A memory-hungry cache on a general-purpose family may leave most of its vCPUs idle, because you bought vCPUs just to get RAM.
Over-provisioning is different from headroom. Headroom is deliberate spare capacity for spikes, failover, and growth. Right-sizing removes unexplained slack. It does not remove all slack.
Why it happens
Over-provisioning is rarely a mistake by one person. It is the result of reasonable decisions made with little information.
- Guessing at launch. Before a service has traffic, nobody knows its needs. Engineers pick a size that is clearly big enough, because an outage costs more than an extra hundred dollars a month.
- Fear of regression. Once a service works, nobody wants to risk it by changing the instance. The sizing decision stays for years.
- Lift-and-shift sizing. Teams that move from data centers often copy the on-premises server specs. Those servers were bought for a five-year peak and are often lightly used.
- Peak-based sizing. A job that runs for ten minutes a day at 90% CPU can drive a decision to buy a large instance for all 24 hours.
- Copied templates. Infrastructure-as-code modules and examples carry a default instance type. New services inherit it without anyone choosing it.
- No feedback loop. Developers choose sizes, but finance sees the bill. Without a per-team view of cost and utilization, nobody sees the waste.
- Single-resource tuning. A service that is memory-bound gets a larger instance, which adds vCPUs it does not need.
What you pay for on EC2
An EC2 bill has several parts. Compute is usually the largest, but it is not the only one.
| Cost driver | What you are charged for | What you can change |
|---|---|---|
| Instance hours | Each hour or second an instance is running, at the rate for its type | Size, family, processor architecture, running schedule |
| Purchase option | On-Demand, Savings Plans, Reserved Instances, or Spot | Commitment level and workload fit |
| EBS volumes | Provisioned GB per month, plus any extra IOPS and throughput | Volume size, type, and unused volumes |
| Data transfer | Traffic between Availability Zones, between Regions, and out to the internet | Architecture and placement |
| Supporting services | Load balancers, NAT gateways, public IPv4 addresses, monitoring | Count and configuration |
Two details matter in practice.
First, a stopped instance does not accrue instance-hour charges, but its attached EBS volumes still do. Stopped instances that nobody deleted are a common source of small, steady waste.
Second, price scales with size in a regular way. Within one family, each step up in size usually doubles the vCPUs and memory and doubles the hourly price. Take an m5 instance as an example:
| Instance type | vCPU | Memory | Illustrative On-Demand price per hour | Approximate monthly cost (730 hours) |
|---|---|---|---|---|
| m5.xlarge | 4 | 16 GiB | $0.192 | $140 |
| m5.2xlarge | 8 | 32 GiB | $0.384 | $280 |
| m5.4xlarge | 16 | 64 GiB | $0.768 | $561 |
Moving one workload from m5.2xlarge to m5.xlarge saves about $140 per month. Across 100 similar instances, that is about $14,000 per month, or $168,000 per year. Small per-instance differences add up quickly.
Seeing where your money goes
Before you measure utilization, find out which instance types account for your spend. Start with what is running:
aws ec2 describe-instances \
--filters Name=instance-state-name,Values=running \
--query 'Reservations[].Instances[].InstanceType' \
--output text | tr '\t' '\n' | sort | uniq -c | sort -rnThe output is a count of running instances per type, largest group first. A fleet dominated by a few large types shows you where to look first.
Then ask Cost Explorer what each instance type cost last month:
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=INSTANCE_TYPE \
--filter '{"Dimensions":{"Key":"SERVICE","Values":["Amazon Elastic Compute Cloud - Compute"]}}'The response lists cost per instance type. Sort it and focus on the largest lines. A type that costs $20,000 per month is worth an hour of analysis. A type that costs $30 is not.
Cost Explorer must be enabled in the account, and the first request may take time to return data in a new account. Tags help here. If your instances carry tags such as team or service, you can group by tag instead and give each team its own number.
The levers you can pull
Once you know where the money goes, there are four ways to reduce it. The remaining chapters cover them in detail.
- Right-size. Match instance size to measured need. This is usually the first and safest step.
- Change family. Choose a family whose ratio of vCPU to memory fits the workload.
- Change architecture. Move suitable workloads to Graviton, the Arm64 processors designed by AWS. AWS documents better price-performance for many workloads, but the gain depends on your software and must be measured.
- Change purchase option. Use Savings Plans, Reserved Instances, or Spot for the capacity you keep.
The order matters. If you buy a commitment first and right-size afterwards, you can end up committed to capacity you no longer need. The last chapter in this tutorial returns to this point.
Why you cannot judge from the instance type alone
Beginners often assume that a large instance means a busy workload. The reverse is common. You cannot read utilization from the instance type, the instance name, or even from how critical the service is. You need data.
Several traps are worth knowing now:
- Averages hide peaks. An instance with 10% average CPU may spike to 95% every hour. Look at the maximum and a high percentile, not only the average.
- Memory is invisible by default. EC2 publishes CPU, network, and disk metrics to CloudWatch without any setup. It does not publish memory or filesystem usage from inside the operating system. You need the CloudWatch agent for those. A right-sizing decision based on CPU alone can move a memory-bound workload to an instance that is too small.
- Burstable instances behave differently. The T families (such as t3 and t4g) earn CPU credits while idle and spend them under load. A low CPU reading can be normal, and a throttled instance can look quiet. Chapter 2 covers how to read them.
- Short windows mislead. One quiet week misses month-end processing or seasonal traffic. Use at least two weeks of data, and longer for workloads with monthly cycles.
- Application settings can fill memory. A JVM configured with a fixed heap, or a database configured to use most of RAM, will report high memory use even when it needs less. The setting, not the load, is the cause.
Costs of being too small
Right-sizing is not cost cutting at any price. Under-provisioning has costs of its own: slow responses, timeouts, failed jobs, and pages at night. The goal is the smallest configuration that still meets your performance targets with a margin you chose on purpose.
To keep that balance, write down the targets before you change anything. Examples include a p99 latency under 200 ms, a batch job finishing within its window, or CPU staying below 70% at peak. A resize that meets those targets is a success. A resize that saves money and breaks the targets is not.
A short example
A team runs a web API on six m5.2xlarge instances behind a load balancer. Nobody has measured them since launch.
A look at the data shows the following:
- Average CPU is 12%, and the two-week maximum is 41%.
- Memory use is about 9 GiB of 32 GiB.
- Network traffic is far below the instance's limits.
The workload needs about 4 vCPUs and 12 GiB of memory with headroom. An m5.xlarge has 4 vCPUs and 16 GiB. The estimated saving is six instances times about $140 per month, or about $840 per month, before any family or architecture change.
The same data also points to later steps. The workload is not memory-heavy and its CPU load is steady, so it may be a good candidate for Graviton. You would test that separately, after right-sizing, so you can attribute each change in cost and performance to one cause.
Summary of what you now know
- You pay for provisioned capacity, not used capacity, so idle headroom is a direct cost.
- Over-provisioning comes from guessing, fear of change, copied defaults, and missing feedback.
- Instance hours are usually the largest EC2 cost, and price roughly doubles with each size step in a family.
- You can find where spend is concentrated with
describe-instancesand Cost Explorer before measuring anything. - Instance type does not tell you utilization. Measurement does, and it must cover CPU, memory, network, and disk over a long enough window.
- Right-size first, then change family or architecture, then commit.
The next chapter shows how to collect the utilization data that these decisions depend on.
Exercise
A team has 20 instances of type m5.2xlarge (about $0.384 per hour). Measurements show each one could run on an m5.xlarge (about $0.192 per hour) and still meet its performance targets. Using 730 hours per month, what is the approximate monthly saving, and why should the team check memory and not only CPU before resizing?
Show answer
Each instance saves about $0.192 per hour, which is about $140 per month (0.192 × 730). Across 20 instances the saving is about $2,800 per month. The team should check memory because EC2 does not publish memory metrics by default, and a workload that looks idle on CPU may still need most of its RAM. Halving the instance size also halves the memory, so a memory-bound workload could fail on the smaller size.
Exercise
You find an instance that has been stopped for three months. Does it still cost money, and what would you check?
Show answer
Yes. A stopped instance has no instance-hour charge, but its attached EBS volumes are still billed for provisioned storage. Check whether the instance and its volumes are still needed. If not, take a snapshot if the data might matter, then terminate the instance and delete the volumes.