Farewell to the Era of Cheap EC2 Spot Instances

AWS spot instances have long been a source of cheap, preemptible compute. Are macroeconomic conditions changing that?

AWS Spot instances offer a discount off on-demand rates in exchange for the risk of instance preemption (running instances stopped) and unavailability (no capacity to start instances). I have long held the belief that spot instances are underpriced, as most tenants underestimate their tolerance for preemption or overestimate its likelihood. In reality, instance preemption is rare in most instance families, and tolerating a large set of different instance types (such as by taking advantage of equivalent instances) can allow drastic savings over on-demand with minimal negative impact. A well-designed spot placement strategy has generally been able to achieve much of the max savings (“up to 90%”) that Amazon claims. In effect, spot compute leverages a market inefficiency in which other tenants pay too much.

It appears, however, that this is changing, and quickly. As macroeconomic conditions change and businesses look to trim costs, cloud bills are on the chopping block. It has recently been reported that Amazon is trying to help customers cut costs through more efficient deployments. Third-party data can give us some idea where this optimization is occuring: on-demand instance usage by Vantage customers dropped to its lowest ever (around 30%). Amazon is likely pushing a similar trend globally, encouraging customers to switch to savings plans/reserved instances and spot instances.

<code>t4g.nano</code> spot pricing in <code>us-east-1</code>

t4g.nano spot prices in us-east-1. Yikes!

At the same time, if you’re already using spot instances you may have noticed your savings start to dry up. I know I did! So naturally I went out and tried to measure it. Is this spike in spot prices just a blip in the radar, or have macroeconomic conditions also had an effect on spot pricing?

Spot price trends

Any good experiment has a hypothesis. Today, we’re testing the hypothesis that there’s only so much spot savings to go around. By this I mean in aggregate: as more tenants move to spot instances will Amazon bring in less money, or is there some fixed amount of overall spot discount that is “split” between customers? The last couple months would argue that our hypothesis is true, and as more businesses use spot instances the savings will continue to diminish. For example:

Mean Spot Price/On Demand ratio grouped by region

This figure shows aggregate spot ratios (the mean ratio of spot price to on-demand price, across availability zones/instance types) within each region over the past year. These values shift with supply and demand constantly, but historically have kept within a tight range. That is, until the past few months. Since the start of 2023, spot ratios have spiked as much as 55% (in us-east-1). In four of the largest AWS regions1 prices have skyrocketed, and others may not be far behind.

Regardless of what is causing it, these increased prices are surely putting pressure on cloud customer compute budgets. Next, we’ll take a deeper dive and try to pin down why they’re occuring, and also some ideas on what to do about it.

Inferring demand: preemption rates

Without more details, one might suspect that this is just Amazon playing with pricing levers. One way that we can differentiate this is by looking at the actual underlying infrastructure: if actual spot instance demand is increasing then we would expect to see an increase in instance preemptions.

Thankfully, our research group manages a large-scale deployment of t3/t4 spot instances. Between October 2022 and today, we’ve provisioned 5.5 million spot instances on AWS across all regions. We use these to study how cloud providers allocate IP addresses and its effect on tenant security. Each server runs for 10 minutes each before shutting down, but we also track when instances get preempted. Here’s a plot of preemption rates for spot instances in regions with price spikes vs. without:

Preemption rate in spiked regions vs. others

We see a near quadrupling in preemption rates in the span of just a few months! Note that our spot pools are diversified across instance families, availability zones, and in this case even regions! The data suggest a marked increase in aggregate spot instance demand. Note that these preemption rates are across the 10-minute windows that instance are deployed for, so in a given month the odds of being preempted are much higher!

What instance families are most affected?

Of course, increase in demand may not affect all instance types equally. Let’s look at spot price changes by instance family. In this table, note that prices are normalized as a fraction of the on-demand cost:

FamilyPrice 2023-01-01Price 2023-05-01Change
m30.240.53+158%
a10.320.77+148%
t3a0.350.75+115%
g5g0.340.69+108%
t4g0.350.69+105%
inf10.340.66+105%
t20.310.61+97%
c6id0.330.6+90%
c6in0.260.49+89%
c5a0.40.74+88%
t30.320.61+87%
g30.310.57+87%
g4ad0.320.6+86%
h10.360.65+85%
m6in0.240.43+85%
m40.330.59+84%
c40.320.57+84%
c5ad0.410.73+83%
c5n0.310.53+82%
m6idn0.210.38+81%
m6id0.320.52+80%
r30.210.35+80%
r40.250.43+79%
vt10.560.78+77%
m6a0.410.69+77%
c6a0.440.75+77%
m5a0.40.69+76%
r5ad0.270.45+75%
c30.480.69+75%
r5a0.30.51+74%
r6a0.330.54+72%
c7g0.450.79+72%
r6in0.190.32+71%
c6gn0.380.62+71%
m6i0.360.59+70%
r6idn0.180.29+70%
m6gd0.350.59+69%
c6gd0.380.66+69%
m5ad0.380.58+67%
r6id0.260.41+67%
m5n0.350.52+66%
m5zn0.260.38+65%
m5d0.310.49+65%
c6i0.360.6+64%
c5d0.320.5+62%
r5n0.260.39+62%
c6g0.450.72+62%
m50.330.54+62%
r6gd0.30.48+61%
im4gn0.30.48+60%
m6g0.410.65+59%
r5d0.260.39+59%
m5dn0.350.45+59%
r5b0.320.39+58%
r6i0.30.44+56%
g4dn0.310.48+55%
r6g0.320.49+52%
x2gd0.380.51+51%
z1d0.330.48+51%
r5dn0.290.37+46%
c50.360.48+35%
g50.330.44+31%
x2idn0.380.43+31%
r50.280.35+30%
x10.30.39+28%
c10.560.27+26%
i30.330.38+16%
d30.340.36+15%
i4i0.350.36+11%
is4gen0.30.33+11%
i20.30.33+8%
d20.30.31+4%
dl10.30.31+3%
i3en0.310.31+1%
p20.420.38+0%
trn10.30.3+0%
p4d0.30.3+0%
p3dn0.30.3+0%
x1e0.30.3+0%
d3en0.410.32-7%
g3s0.350.3-11%
x2iedn0.430.31-12%
p30.390.3-13%
f10.430.31-14%
x2iezn0.460.3-15%
g20.840.52-24%
m10.350.21-25%
m20.610.26-37%
t10.50.19-39%

There’s quite a bit of range here, though the overall trend is positive. The price reductions are more of an exception that proves the rule, as older families (such as m1 and t1) have too poor of compute performance to be price competitive.

Managing spot instance cost

Overall, I think we’ve entered a race to the bottom in terms of spot discounts. For now, you can likely still reduce your bills by diversifying across equivalent instances in other families. The largest price win you can get would be to move to a region that has not (yet!) seen price spikes, but this is probably not feasible for a lot of architectures.

On the plus side, spot prices can’t keep rising forever. Since Amazon’s new spot pricing model, it appears that spot prices rarely if ever exceed on-demand prices. If your architecture is designed to accept preemption and the cost of provisioning replacement instances isn’t too high (e.g., compute time to start a new instance), you probably won’t turn out worse than if you used on demand instances. Using spot instances can also be seen as a sort of built-in chaos monkey, since even on-demand instances can fail. However, as the discount on spot instances erodes it may make less and less sense to invest in the resilient design to use them.

Takeaways

Spot instances have offered an incredible price advantage to those who are willing to architect around preemptible instances, but the party may be coming to close. While there is still some savings to be had, organizations should make their architecture decisions in light of these decaying benefits, and more strongly consider approaches with more guaranteed savings (such as Savings Plans) when they have predictable usage.


  1. By size of IPv4 range ↩︎

Eric Pauley
Eric Pauley
PhD Student & NSF Graduate Research Fellow

My current research focuses on practical security for the public cloud.