Everything You Should Know About EC2 Spot Instances


AllCloud Blog:
Cloud Insights and Innovation

As usual, re:Invent brought many changes. Amongst the major changes was an increased focus on EC2 Spot Instances, as AWS continues to sell its spare EC2 capacity. In this article, we’ll dive into the updates and explain how they affect you – whether you’re running on Spot Instances today or just interested in starting to leverage them after the new updates that were announced at re:invent.

How do the changes that AWS announced to Spot Instances affect me?

Well, if you’ve never used Spot Instances, this is a great time to get started. Getting started with Spot Instances has never been this easy. If you are an existing Spot user, you’ll enjoy longer uptime and availability and a more standard API call to launch Spot Instances.

  • It’s way easier to get started with Spot Instances. By removing the need to determine a bid price, there’s little learning to be done before diving into the world of Spot Instances. They basically work like On-Demand Instances now, only way cheaper.
  • Not as many price adjustments – While the Spot prices still may change, adjusting gradually based on long-term supply and demand means that you can rest a bit easier while running on Spot. No longer you will see noisy Spot price graphs or be kicked-out by another Spot customer. You will only be interrupted if EC2 needs that capacity for another On-Demand customer or when the Spot price rises above your Maximum price for instance hour.
  • Hibernation! By using this new feature, you won’t lose all your data when your Spot Instance goes down. This makes running things like high-performance computing jobs on Spot a lot easier.

The New EC2 Spot pricing system lowers the bar for new customers to get started with Spot Instances, using a simple and more confident approach to enjoy AWS’ spare capacity for short-lived workloads like stateless and dev environments. However, if you are thinking of migrating production workloads today to Spot, there are several factors you should consider.

All The Changes Made To EC2 Spot Instances During re:invent 2017

So what are the actual changes? Let’s go through each of them one-by-one.

1. Spot Price Changes Are Less Frequent

Before re:invent, Spot prices adjusted based on real-time supply and demand, sometimes spiking up and dropping suddenly every single second.

Post re:Invent, Spot prices adjust gradually based on long-term supply and demand for spare EC2 capacity. This means that you don’t need to watch price changes as carefully and can rely on Spot Instances to be a bit steadier.

Still, AWS can terminate your EC2 Spot capacity based on supply and demand but without reflecting it on the Spot price history. The main benefit here is that you won’t see those multiple spikes happen every second. This allows you to use Spot for transient apps and dev environments with more confidence.

2. Bidding for Spot Instances Becomes Optional

Before re:invent, customers were required to set a maximum bid for Spot Instances. Whenever this maximum bid was exceeded by the Spot market price, this would trigger an interruption of your Spot Instance within two minutes.

Post re:invent, this bidding process is optional. Customers can access and launch Spot Instances just like they would have an On-Demand Instance. Getting rid of this additional complexity removes a lot of the friction that has kept many customers from diving into the world of Spot Instances.

This optional parameter Spot Price (bid price) will now determine the maximum price you would be willing to pay for a Spot Instance hour, and by default, is set at the On-Demand price.

As before, you continue to pay the Spot Instance price, not your maximum price, at the time your instance is running, charged in per-second increments.

You Should Now Be Asking Yourself – “Wait, So When Does My Spot Instance Get Interrupted If I Don’t Submit A Bid Price?”

The answer is simple but a bit tricky to monitor. AWS will interrupt your Spot Instance for two possible reasons:

  1. If AWS runs out of spare capacity for that Instance type.
  2. If Spot price exceeds your bid price.

The flip side here is that interruptions will be harder to predict, as you will have less visibility into the trajectory of the Spot price.

3. New Feature: Hibernate for Spot

This is a really nifty new feature that could make your life a lot easier.

Whenever your Spot Instance is interrupted, rather than being terminated, it will instead hibernate. All your data will be saved into an EBS volume and your Instance will reboot once there is spare capacity of your requested Instance type.

You can use hibernation when your instance(s) need to retain instance state across shutdown-startup cycles, i.e. when your applications running on Spot depend on contextual, business, or session data stored in RAM.

Hibernation is best suitable for the toughest HPC workloads. It may take longer to run your workloads, but they’ll be completed eventually and you won’t lose the data or the state of your memory.

4. Launching Spot Instances via RunInstances API

You can request Spot Instances from the same API you use for On-demand and Reserved Instances by simply specifying Spot for Instance Market Option option.

5. T2 Instances Are Now Available as Spot Instances

Great news for EC2 customers, burstable EC2 Instances (T2) are now also available for purchase in  the Spot pricing model. That brings AWS to support all of its EC2 capacity for purchase as Spot.

AWS’ General Manager of EC2 has commented on the recent changes:

“Today, we launched a new pricing model and simplified access to Amazon EC2 Spot Instances. With these changes, you can launch Spot instances the same way you launch On-demand Instances, and customers can now count on low, predictable prices.

Spotinst has been helping AWS customers to leverage Spot Instances for many years. By supporting these new features, Spotinst’s service enables customers to move additional workloads to Spot Instances with less-effort and greater confidence.”

Joshua Burgin, General Manager, EC2, Amazon Web Services

To sum up – these changes bring a new spirit to EC2 Spot Instances, immediately opening the door for innovation as to which workloads a DevOps team can run on EC2 Spot with confidence. This is the dawn of a new era for using Spot Instances, one where the relevant workloads are limited only by your imagination.

Start saving 80% on your cloud costs using Spotinst. 

Amiram Shachar

Read more posts by Amiram Shachar