Sub topic 3
A repeatable right-sizing method
This chapter assumes you know EC2 instance types, can run AWS CLI commands, and can read basic CloudWatch metrics. You will turn raw utilization data into a decision you can repeat for every instance in a fleet.
Why a method matters
Right-sizing done by gut feeling produces two errors. You shrink an instance that looked idle on a quiet Tuesday and it fails at month-end. Or you never touch anything because nobody can prove a change is safe. A fixed procedure gives you evidence, a small change, and a way back.
The method has six steps.
Step 1: Scope the fleet
List the instances you want to review and group them by role, such as web, batch, or database. Skip instances that are already tiny, short-lived, or scheduled for retirement. Savings there are small and the review time is not.
Step 2: Collect enough data
Use at least two weeks of data so that weekly cycles show up. If the workload has monthly peaks, such as billing runs, include a month. The command below returns hourly average and maximum CPU for one instance.
aws cloudwatch get-metric-statistics \
--namespace AWS/EC2 \
--metric-name CPUUtilization \
--dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
--start-time 2026-11-01T00:00:00Z \
--end-time 2026-11-15T00:00:00Z \
--period 3600 \
--statistics Average MaximumAverages hide spikes, so always read the maximum next to the average. Memory and disk space are not in the AWS/EC2 namespace. You need the CloudWatch agent to publish them, otherwise you are judging only on CPU and network.
Step 3: Find the binding resource
Every workload is limited by one resource first. That is the binding resource. Compare each metric against a rule of thumb.
| Signal | Reading | What it suggests |
|---|---|---|
| CPU maximum below 40% | Plenty of headroom | Try a smaller size |
| CPU average above 70% | Little headroom | Keep size or go larger |
| Memory used below 50% | Memory is oversized | Try a smaller size or a compute-optimized family |
| Memory high, CPU low | Memory is binding | Try a memory-optimized family |
| Network near the instance limit | Bandwidth is binding | Choose a size with more bandwidth |
These thresholds are starting points. Adjust them to how much risk the workload can take.
Step 4: Pick a target
Move one step at a time. Within a family, each size up or down roughly doubles or halves vCPU and memory, so going from m5.2xlarge to m5.xlarge halves capacity. Estimate the new utilization before you change anything. If an instance peaks at 35% CPU on 8 vCPUs, it uses about 2.8 vCPUs at peak. On 4 vCPUs the same load peaks near 70%. That is acceptable for many services, and too tight for latency-sensitive ones.
You can get a second opinion from AWS Compute Optimizer. It needs an opted-in account.
aws compute-optimizer get-ec2-instance-recommendations \
--instance-arns arn:aws:ec2:us-east-1:111122223333:instance/i-0123456789abcdef0Treat its output as input to your decision. The next chapter covers how to read it.
Step 5: Test and change one step
Try the new size in a non-production environment under realistic load. In production, change one instance or one Auto Scaling group at a time. Record the old type so that you can reverse the change.
Step 6: Verify and keep watching
After the change, watch the same metrics for at least one full business cycle. Check application signals too, such as latency and error rate. CPU alone does not tell you whether users are happy. If any signal crosses your limit, roll back to the recorded type. Then schedule the next review, because workloads drift.
Common mistakes
- Judging by average CPU only, which hides peaks.
- Using a quiet period as the sample.
- Ignoring memory because the default metrics do not show it.
- Changing the size and the processor architecture in the same step. If something breaks, you cannot tell which change caused it. Finish right-sizing first, then consider Graviton.
Exercise
An instance of type m5.2xlarge (8 vCPUs) shows an average CPU of 12% and a maximum of 30% over three weeks. Memory use, from the CloudWatch agent, peaks at 40%. Which target would you try first, and what peak CPU do you expect there?
Show answer
Try m5.xlarge (4 vCPUs). Peak load is about 30% of 8 vCPUs, or 2.4 vCPUs. On 4 vCPUs that is about 60% CPU at peak, which leaves headroom. Memory also halves its headroom, going from 40% to about 80% of the smaller size, so check that your application tolerates that, or consider a compute-optimized family with less memory per vCPU. Change one step only, test it, and keep the old type recorded for rollback.
Exercise
Why should you avoid switching to a Graviton instance type in the same change as a size reduction?
Show answer
If the application slows down or fails, you cannot tell whether the smaller size or the different processor architecture caused it. Changing one variable at a time keeps the cause clear and the rollback simple.