Eternal Savings Of A Spot Instance

First of all, let us understand what Spot instances actually are and how spot pricing works.

  1. Current spot price of a particular instance type in us-east-1a is $0.5/hour.
  2. And, you are willing to pay a maximum of $1 for that particular instance type in us-east-1a. So, you basically set your maximum bid price to $1 for that instance.
  3. Now, the demand(from other AWS users) for that particular instance type in us-east-1a starts increasing and others start bidding more than you.
  4. AWS now decides to increase the spot price of that instance in us-east-1a to meet the increased demand.
  5. And this process happens continuously to meet the equilibrium of demand and supply of that particular instance type in us-east-1a.
  6. Now, when the price of the spot instance becomes more than $1, AWS gives you a 2 minute warning and your instance is taken back by AWS to meet the demand. Spot-loss :( Can happen anytime and everyone hates it.

So, if you are eventually going to have a spot-loss, why use spot instances at all?

Well, Cost. Spot instances are available at a discount of up to 90% off compared to On-Demand pricing.

What if you don’t want the spot-loss to happen and at the same time avail the benefit of low spot prices.

How is that possible? and if that is possible why use on-demand at all?

(0.05 * 5) + (0.95 * 0.3) = 0.535

So basically you paid the average price of $0.535/hour instead of $1 which is still around 47.5% of savings with zero spot loss.

Now, let’s come to our main objective of this article.

What’s new?

Smooth Price Changes for Spot Instances

spot price history for m2.xlarge instance type in us-east-1 region
  1. Spot prices before 29th Nov 2017 i.e., before smooth price change announcement.
  2. Spot prices from 29th Nov 2017 i.e., after smooth price change announcement.

As part of today’s launch we are changing the way that Spot prices change, moving to a model where prices adjust more gradually, based on longer-term trends in supply and demand.

This eventually lead to a stable and gradual increase/decrease in the pricing of spot instances. So, now the spot-loss will only happen when the spot price becomes equal to the on-demand price for that particular instance and you won’t be able to request a spot instance as long as the spot price of that instance is equal to the on-demand price. In this case you are actually better off with on-demand instance itself.

How to use it to optimize the cost?

Now, whenever you are running an instance for the tasks where less stability is required or stability is required for a lesser time you can switch to spot instance.

spot price history for m2.xlarge instance type in us-east-1 region

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store