Many engineers use Amazon Web Services to buy cloud computing on demand. However, the price you’re paying could be a premium compared to spot instances, which lets you buy excess AWS capacity at a discount in an auction process. The only problem is that you risk being outbid and seeing your instance terminate at any time!
How good of a deal are spot instances? Where can I find the best deal? Using the boto API, I was able to download AWS pricing data. I looked at 90 days (1 March to 1 June 2017) of spot pricing data across every availability zone and nine instance types (m4.10xlarge, m4.16xlarge, c4.4xlarge, c4.8xlarge, x1.16xlarge, x1.32xlarge, r4.4xlarge’, r4.8xlarge, r4.16xlarge) to find the best deals.
Average Spot Prices
c4.4xlarge’s are normally $0.796/hr on demand, but the 90 day average across all availability zones was $0.357/hr (55.2% off!)
c4.8xlarge’s are normally $1.591/hr on demand, but were $0.628/hr on spot (60.5% off!)
r4.4xlarge’s are normally $1.064/hr on demand, but were $0.393/hr on spot (63.1% off!)
r4.8xlarge’s are normally $2.128/hr on demand, but were $0.788/hr on spot (63.0% off!)
r4.16xlarge’s are normally $4.256/hr on demand, but were $1.885/hr on spot (55.7% off!)
m4.10xlarge’s are normally $2/hr on demand, but were $1.286/hr on spot (35.7% off!)
m4.16xlarge’s are normally $3.2/hr on demand, but were $1.091/hr on spot (34.1% off!)
x1.16xlarge’s are normally $6.669/hr on demand, but were $3.543/hr on spot (46.9% off!)
x1.32xlarge’s are normally $13.338/hr on demand, but were $10.740/hr on spot (19.5% off!)
These prices fluctuate a lot, though, and I’d be curious to check in another three months whether these average prices are indicative of long-term trends.
Price per Core, Price Per GB RAM
If one has a very CPU intensive task that can be distributed across machines, one might just be interested in getting the best deal on $/core, regardless of what machine it is on. Similarly for $/GB of RAM.
With on demand pricing, the best deal on $/core has been the c4.8xlarge, which provides a core for $0.044/hr (36 cores for $1.591/hr). The best deal for on demand $/GB RAM is the beefy x1.32xlarge with each GB of RAM costing $0.0068 (1952 GB RAM for $13.34/hr).
However, this changes with spot instances. The cheapest $/core in spot instances, over the last ninety days averaging across all availability zones, ends up being the m4.16xlarge clocking in at $0.017/core (64 cores for $1.091/hr). If you’re choosy across availability zones, the r4.16xlarge in us-west-2c surprisingly provides the best deal at $0.013/core, despite being RAM optimized!
The cheapest $/GB RAM in spot instances was surprisingly the compute-optimized c4.8xlarge at $0.01/GB RAM. (I did double check that I did not swap CPU and RAM in my coding!) Across individual availability zones, the x1.16xlarge in us-west-2a gave the best individual deal at $0.0016/GB RAM.
Go West For the Best Deals
It seems like the best deals are in the us-west region. The us-west region gave the best deals on $/GB RAM and $/core. Also, the lowest spot price I found, on average over the last ninety days, was the r4.4xlarge in us-west-1a for $0.29/hr and the largest single discount I found was r4.16xlarge in us-west-2c, which at $0.83/hr is an 80.5% sale compared to the on demand price of $4.256/hr.
Here’s the code used to generate the dataset used for the above analysis: