HiveBrain v1.2.0
Get Started
← Back to all entries
patternMajor

Why is the AWS EC2's spot price greater than the on-demand price?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
whythepricegreaterspotthanec2awsdemand

Problem

I was trying to provision spot instances via Ansible yesterday, and almost all my requests failed, even when I put my spot price == the on-demand price of that instance.

So, when I had a look at the spot pricing graph, I found something very interesting:



The spot price of the instance in us-east-1a is more than the on-demand price, which confused me. [in fact, ~5x times higher]

Aren't spot instances preferred for the low cost? If yes, then why is the price higher than the on-demand price?

According to AWS's docs:


Spot instances provide you with access to unused Amazon EC2 capacity
at steep discounts relative to On-Demand prices.

Also, does this mean that people are bidding over the on-demand price? If yes, then why so? Aren't they better off with an on-demand instance?

Or did I understand the concept of spot instances wrong?

Solution

This is actually a great example of people slightly abusing spot. People are saying 'Our workload is really important but we don't want to pay full on demand price', so they set a bid price higher than on-demand on the assumption that it is very unlikely to be terminated, but still want to get the 'cheapest possible' spot price on offer.

There have been cases where people enter, for example, $1000 (I've been told of at least one time this happened) because they want the benefit of the spot market. Of course naturally at some point the demand comes in and the spot price SOARS to make people pay higher than on-demand.

The way the spot market works is that Amazon have X instances spare capacity, and they count from the top down until they fill the need for all X instances. The 'price', then, is the lowest price at which they can fulfill those X instances.

So imagine Amazon have 10,000 instances - well they will count down to (say) $0.43 until they've got those 10,000 instances fulfilled. But if that supply suddenly drops to 100 instances, then maybe a few people put bid prices of $10,000 for their 100 instances, suddenly they'll be paying that $10k per hour.

Tl;dr Understand how spot works, and set a cap you are prepared to pay.

Context

StackExchange DevOps Q#893, answer score: 31

Revisions (0)

No revisions yet.