Sub topic 3
Diversifying Spot Capacity and Choosing an Allocation Strategy
Assume you understand EC2 instance types, Availability Zones, AWS Regions, the AWS CLI, and basic cloud billing.
Diversify Spot capacity
Spot Instances use spare EC2 capacity at a lower price, but AWS can reclaim them. A diversified workload uses several instance types and Availability Zones. If capacity disappears for one option, the workload can use another.
For an Auto Scaling group, configure multiple instance types and keep a small On-Demand baseline:
{
"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"
}
}price-capacity-optimized prefers pools that combine a good price with a lower interruption risk. capacity-optimized prioritizes available capacity. Avoid selecting a Spot pool only because it currently has the lowest price.
A Spot interruption usually provides a two-minute notice. Your application should drain work, checkpoint progress, and replace the instance. Poll the instance metadata service or use event-driven monitoring to detect the notice.
Choose a pricing model
| Workload characteristic | Suitable model |
|---|---|
| Steady and interruption-intolerant | Savings Plan or RI |
| Flexible and interruptible | Spot |
| Uncertain or short-lived | On-Demand |
Use commitments for predictable baseline usage. Use Spot for batch jobs, stateless workers, and fault-tolerant queues. Keep On-Demand capacity for unpredictable demand or critical capacity.
Measure coverage and utilization
Savings Plans coverage shows how much eligible spend receives a commitment discount. Utilization shows how much of the committed hourly amount you actually use.
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 MONTHLYUse purchase recommendations as a starting point, not an automatic decision:
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_DAYSLayer commitments and Spot
Estimate the steady minimum first. Cover that baseline with a Savings Plan or suitable RI. Run flexible growth on Spot, and retain enough On-Demand capacity for urgent or non-interruptible work. Recheck utilization after deployments and seasonal changes.
Sell unused Standard RIs
If a Standard RI no longer matches your needs, eligible unused reservations can be listed in the Reserved Instance Marketplace. Convertible RIs cannot be sold there. Check AWS account eligibility, pricing rules, and remaining term before listing. Selling can recover value, but it does not erase the original commitment.
Exercise
A batch processor can retry work and runs continuously, but its worker types may change. Which capacity mix is a sensible starting point?
Show answer
Keep a predictable baseline on a Compute Savings Plan, run flexible workers across several Spot instance types and Availability Zones, and use On-Demand capacity for urgent replacement.