Sub topic 13
Building a layered purchasing strategy
This chapter assumes you know EC2 instance families, Regions, and Availability Zones. It also assumes you know how Reserved Instances (RIs), Savings Plans, and Spot Instances work individually. Here you combine them into one purchasing plan for a single workload fleet.
Why one pricing model is not enough
Each model fits a different part of your usage:
| Model | Discount source | What you give up | Best for |
|---|---|---|---|
| On-Demand | None (list price) | Nothing | Spikes, unknowns, new workloads |
| Savings Plans / RIs | Commitment for 1 or 3 years | Flexibility, and you pay even if you use less | Steady baseline |
| Spot | Spare AWS capacity | AWS can reclaim instances with a two-minute notice | Fault-tolerant, flexible work |
If you buy commitments for your peak, you pay for idle capacity at night and on weekends. If you run everything on Spot, an interruption can take down stateful or latency-sensitive work. If you run everything On-Demand, you pay the highest rate for load you could have predicted. A layered strategy gives each slice of demand the cheapest model that its risk profile allows.
The layers
Picture your hourly usage as a stack. The bottom is the load that never goes away. Above it is load that varies but can tolerate interruption. The top is whatever remains.
Layer 1: the committed baseline
The baseline is the usage you are confident will exist for the whole term. Find it by looking at your minimum hourly usage over the last 30 to 90 days, not your average. The average includes variable load. The minimum is the part you can safely commit to.
Within this layer, choose the instrument by flexibility needs:
- Compute Savings Plans are the default. They apply across instance families, sizes, Regions, operating systems, and tenancy. They also cover Fargate and Lambda usage. Use them when your fleet changes over time.
- EC2 Instance Savings Plans give a deeper discount in exchange for locking to one instance family in one Region. Use them for stable, well-understood fleets.
- Standard or Convertible RIs still make sense in two cases. One is services where RIs apply but Savings Plans do not (for example, RDS and ElastiCache reserved nodes are separate products). The other is when you need a zonal RI to reserve capacity in a specific Availability Zone.
Savings Plans do not reserve capacity. If you need a guarantee that an instance will be available in an Availability Zone, use a zonal RI or an On-Demand Capacity Reservation. The discount and the capacity guarantee are separate decisions.
Layer 2: the uncertain middle
This is load that has run for months but might shrink if a project ends or you re-architect. Do not commit to it yet. Leave it On-Demand, then buy more commitment later in small steps as the data confirms it is stable. This keeps your downside small.
Layer 3: Spot for flexible capacity
Spot can lower cost by a large margin, but only for work that survives interruption: stateless web tiers behind a load balancer, batch jobs, CI runners, data processing with checkpoints, and containers that reschedule easily. Spot usage is not covered by Savings Plans or RIs, so you do not double up. Spot capacity sits beside your commitments, not underneath them.
Layer 4: On-Demand for the rest
On-Demand absorbs sudden spikes, new workloads without history, and anything that cannot be interrupted but is not steady enough to commit to. Treat its share as a signal. A large and stable On-Demand share means you have commitment you could buy. A shrinking one means your commitments are keeping up.
Worked example
Suppose a web service shows these numbers over the last 60 days (eligible compute spend at On-Demand rates):
- Minimum: $10 per hour (overnight)
- Typical daytime: $18 per hour
- Peak (sales events): $30 per hour
A reasonable plan:
- Baseline: buy a Compute Savings Plan sized below the minimum, not at it. A Savings Plan commitment is expressed in dollars per hour at the discounted rate, so if the plan gives about a 30 percent discount, $10 of On-Demand usage costs roughly $7. Commit about $6 per hour so a small dip in usage does not leave commitment unused.
- Flexible layer: move the stateless web tier above the baseline to Spot with several instance types.
- Spikes: let the Auto Scaling group add On-Demand instances only when Spot capacity is not available.
- Review in 30 days and add another small commitment if utilization is at 100 percent and On-Demand spend is steady.
The discount percentages here are illustrative. Check current rates for your instance types and Region before sizing.
Implementing the Spot and On-Demand mix
An Auto Scaling group can hold the baseline on On-Demand instances (which your commitments cover) and fill the rest with Spot. This policy keeps two On-Demand instances as a floor, uses Spot for everything above that, and spreads Spot across three instance types:
{
"LaunchTemplate": {
"LaunchTemplateSpecification": {
"LaunchTemplateName": "web-template",
"Version": "$Latest"
},
"Overrides": [
{ "InstanceType": "c5.large" },
{ "InstanceType": "c5a.large" },
{ "InstanceType": "m5.large" }
]
},
"InstancesDistribution": {
"OnDemandBaseCapacity": 2,
"OnDemandPercentageAboveBaseCapacity": 0,
"SpotAllocationStrategy": "price-capacity-optimized"
}
}Save it as policy.json and pass it when you create the group. The subnet IDs are placeholders:
aws autoscaling create-auto-scaling-group \
--auto-scaling-group-name web-asg \
--min-size 2 \
--max-size 20 \
--vpc-zone-identifier "subnet-0123456789abcdef0,subnet-0fedcba9876543210" \
--mixed-instances-policy file://policy.jsonThree details matter for the layering:
OnDemandBaseCapacity: 2is the part your commitment covers. If your commitment is a Compute Savings Plan, it also covers these instances if you later change their family.- Three instance types in different families give Spot more capacity pools to draw from. When one pool is reclaimed, the others are usually unaffected.
price-capacity-optimizedfavors pools with the most available capacity and, among those, the lowest price. This lowers interruption rates compared with choosing by price alone.
On the instances themselves, poll for the interruption notice so your application can drain connections or checkpoint work within the two minutes:
TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" \
-H "X-aws-ec2-metadata-token-ttl-seconds: 300")
curl -s -H "X-aws-ec2-metadata-token: $TOKEN" \
http://169.254.169.254/latest/meta-data/spot/instance-actionThis returns 404 until AWS issues a notice. In production, run this check in a loop or rely on the Amazon EventBridge "EC2 Spot Instance Interruption Warning" event.
Sizing the commitment with data
Do not guess the commitment. Ask Cost Explorer for a recommendation based on recent usage:
aws ce get-savings-plans-purchase-recommendation \
--savings-plans-type COMPUTE_SP \
--term-in-years ONE_YEAR \
--payment-option NO_UPFRONT \
--lookback-period-in-days THIRTY_DAYSTreat the output as a starting point. The recommendation is built to maximize savings from the lookback window, so it can be more aggressive than you want if the window included an unusual busy period. Compare its hourly commitment to your own minimum-usage figure. If the recommendation is higher, buy the lower of the two.
After purchase, track two measures every month:
aws ce get-savings-plans-coverage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY
aws ce get-savings-plans-utilization \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY- Coverage is the share of eligible spend that Savings Plans paid for. Low coverage means eligible usage is billed at On-Demand rates, so there is room to commit more.
- Utilization is the share of your hourly commitment that was used. Below 100 percent means you are paying for commitment you did not use.
Read them together:
| Coverage | Utilization | Meaning | Action |
|---|---|---|---|
| Low | High (near 100%) | Commitment is fully used, but much usage is uncovered | Buy more in a small step |
| High | High | Well balanced | Hold, and check again next month |
| High | Low | Over-committed | Stop buying. Let usage grow or move work onto covered types |
| Low | Low | Usage dropped or moved to ineligible services | Investigate before any purchase |
Spot usage lowers coverage numbers because Spot is not eligible. A low coverage figure is not a problem if the uncovered usage is Spot you chose deliberately. Filter or group by purchase option to see this.
Operating the strategy over time
- Buy in steps. Purchase 50 to 70 percent of the identified baseline first, then add more each month or quarter. This reduces the cost of a bad forecast.
- Stagger expiry. If you buy everything on one day for one year, everything expires on one day. Spreading purchases keeps renewal decisions small.
- Prefer shorter terms when the future is unclear. A 3-year term gives a larger discount but ties up money in a fleet that may change.
- Know how plans apply. When several commitments exist, AWS applies Reserved Instances and EC2 Instance Savings Plans before Compute Savings Plans, so the broader plan absorbs what the narrower ones do not cover.
- Re-check after migrations. Moving workloads to Graviton, to containers, or to another Region can strand an EC2 Instance Savings Plan or a Standard RI. Compute Savings Plans and Convertible RIs handle such changes better.
Common mistakes
- Committing to the average or the peak instead of the minimum.
- Expecting a Savings Plan to guarantee capacity. It does not.
- Running Spot with one instance type in one Availability Zone, which concentrates interruption risk.
- Ignoring the notice. Without a handler, the two minutes are wasted.
- Chasing 100 percent coverage. Some On-Demand and Spot usage is the intended design.
Exercise
A fleet's lowest hourly eligible usage over 90 days is $12 at On-Demand rates, its daytime usage is $20, and its Cost Explorer recommendation suggests a commitment equivalent to $16 of On-Demand usage. Which layers would you use, and what would you buy first?
Show answer
Commit only to the baseline, so use the $12 minimum rather than the recommendation of $16. Buy a Compute Savings Plan below that floor, for example 50 to 70 percent of it, and re-check coverage and utilization after a month. Run the variable load above the baseline on Spot with several instance types, and let On-Demand cover spikes when Spot is unavailable.
Exercise
Utilization of your Savings Plans is 82 percent and coverage is 95 percent. What does this say, and what should you do?
Show answer
You are over-committed: 18 percent of the hourly commitment goes unused, even though nearly all eligible usage is covered. Do not buy more. Find why usage fell, such as a migration to ineligible services or a smaller fleet. Move eligible workloads onto covered instances, or wait for growth to absorb the commitment.
Exercise
Why does the Auto Scaling policy above set OnDemandPercentageAboveBaseCapacity to 0 and OnDemandBaseCapacity to 2?
Show answer
The first two instances are always On-Demand, which gives a stable baseline that commitments can cover. Every instance above those two is Spot, because the percentage of On-Demand above the base is zero. This puts the steady load on the discounted commitment and the flexible load on Spot.