Which EC2 Spot allocation strategy minimizes interruptions?
Amazon EC2 Spot Instances offer significant cost savings over On-Demand prices, though Amazon Web Services can reclaim capacity with a two-minute notice when demand rises. To reduce the frequency of these interruptions when launching a pool of Spot Instances via EC2 Auto Scaling or EC2 Fleet, you should select an allocation strategy that prioritizes spare capacity stability. The most effective strategies for minimizing interruptions are price-capacity-optimized and capacity-optimized, whereas the lowest-price strategy increases interruption risk by focusing purely on immediate unit cost rather than pool availability.
Understanding Spot Capacity Pools
A Spot capacity pool is a set of unused EC2 instances sharing the same instance type and Availability Zone. Each pool has its own fluctuating supply and demand dynamics. When launching Spot Instances across multiple instance types and Availability Zones, an allocation strategy determines how EC2 selects and fulfills capacity from the candidate pools you specify in your launch template or fleet configuration.
If you allow your fleet to draw from \(N\) distinct instance types across \(M\) Availability Zones, the total number of candidate Spot capacity pools \(P\) is given by:
\[P = N \times M\]
Providing a larger value of \(P\) gives the allocation strategy more choices to find deep, stable capacity pools with low reclamation rates.
Allocation Strategies That Minimize Interruptions
Price-Capacity-Optimized (Recommended)
The price-capacity-optimized strategy is the recommended
default for most workloads. It balances two critical goals: minimizing
the likelihood of interruptions and maintaining a low cost.
When you use this strategy, EC2 carries out a two-step evaluation:
- It identifies the candidate Spot pools with the highest available spare capacity, which inherently have the lowest probability of near-term interruption.
- From that subset of high-capacity pools, it requests Spot Instances from the pool with the lowest price.
This approach gives you stability comparable to pure capacity optimization while preventing your fleet from unnecessarily landing on more expensive instance types when equally stable, cheaper alternatives exist.
Capacity-Optimized
The capacity-optimized strategy focuses strictly on
reducing the risk of Spot Instance interruptions without considering
price differences among your allowed instance types.
Under this strategy, EC2 analyzes real-time capacity data and provisions instances from the pools with the most available spare capacity for the number of instances being launched. This is ideal for workloads where the cost of interruption—such as restarting long batch jobs, losing state, or migrating big data nodes—outweighs small variations in hourly Spot pricing.
Capacity-Optimized-Prioritized
Available in EC2 Fleet and Spot Fleet,
capacity-optimized-prioritized operates like
capacity-optimized but allows you to define a priority
order for your instance types. EC2 first optimizes for capacity to
minimize interruptions, and then uses your priority rankings as a
tie-breaker among pools that offer similarly high levels of available
capacity. This is useful when specific instance families provide better
performance for your application, but availability remains your primary
concern.
Allocation Strategies to Avoid for Interruption-Sensitive Workloads
Lowest-Price
The lowest-price strategy provisions instances from the
pools with the lowest current Spot price at the time of fulfillment,
without evaluating the depth of spare capacity in those pools. Because
inexpensive pools often attract heavy demand or have shallow reserves,
instances launched with lowest-price face a significantly
higher rate of interruption. This strategy is generally discouraged
unless your workload is extremely short-lived and completely
stateless.
Diversified
The diversified strategy distributes instances evenly
across all defined Spot pools. While spreading instances across pools
ensures that a single pool outage does not terminate your entire fleet
simultaneously, it forces EC2 to place instances into shallow capacity
pools alongside deep ones. Consequently, individual instance
interruptions occur more frequently than with capacity-aware
strategies.
Comparison of EC2 Spot Allocation Strategies
| Allocation Strategy | Primary Optimization Goal | Interruption Risk | Best Use Case |
|---|---|---|---|
price-capacity-optimized |
Low interruption rate and low cost | Very Low | General stateless web services, containers, CI/CD, and standard batch workloads |
capacity-optimized |
Lowest possible interruption rate | Lowest | High-compute jobs, machine learning training, and stateful big data clusters |
capacity-optimized-prioritized |
Low interruption rate with instance preference | Lowest | Workloads that benefit from specialized hardware when high capacity is available |
diversified |
Even distribution across pools | Moderate | Legacy fleets requiring strict distribution ratios across instance types |
lowest-price |
Cheapest hourly Spot price | High | Ultra-short tasks or testing environments where interruptions have zero impact |
Best Practices to Further Reduce Interruptions
- Practice Instance Flexibility: Include multiple
instance generations, sizes, and families (such as
m5,m6i,c5, andc6i) in your Auto Scaling group or EC2 Fleet configuration. Alternatively, use Attribute-Based Instance Type Selection (ABIS) to specify vCPU and memory bounds, automatically expanding the number of candidate pools. - Span Multiple Availability Zones: Always enable all healthy Availability Zones in your target region so the allocation strategy can route around localized capacity constraints.
- Enable Capacity Rebalancing: Turn on Capacity Rebalancing in EC2 Auto Scaling. When EC2 emits a rebalance recommendation signaling that a Spot Instance is at elevated risk of interruption, Auto Scaling proactively launches a replacement instance using your chosen allocation strategy before terminating the at-risk instance.