This is the second post in a series on ways to save on Amazon Web Services (AWS). Today, let’s look at AWS Spot Instances.
You can also watch the video version of this post:
How AWS Spot Instances Work
AWS runs a spot market on EC2 capacity, which is similar to derivative markets if you’re familiar with those. The spare capacity is bundled in spot pools, based on instance type, platform, and availability zone.
To use spot instances, you place a bid. If there’s spare capacity and your bid price is above the current price, your request is fulfilled and your instances start. They will keep running as long as there’s capacity and your bid price stays above the market price.
You can reap great savings, but there are risks involved. For example, if there is no spare capacity for the instance type you want, you may have to wait a long time before your request is fulfilled.
Additionally, as soon as the market price rises above your bid price or AWS runs out of capacity, your instance is terminated abruptly, after a 2-minute warning.
To mitigate this, you can build applications designed to withstand this interruption, but it’s also led to many creative mitigation strategies.
One is to use a mixture of on-demand and spot instances with persistent requests. Another is to look at older AWS instance types. Since they’re not the latest “shiny toy”, they tend to be used less, and remain stable longer. AWS also recommends that you remain flexible in the type of instance you use, and in fact, AWS just came out with their new spot fleets, which allows you to launch a mix of spot instances in a single request.
What are the potential savings with AWS Spot Instances?
Here’s an example of an m4.large instance, running in Northern Virginia with Linux. Here’s a 3 month price history. The orange graph shows that the spot price for this instance is 1.4 cents an hour, which is substantially below what it normally runs at on the on-demand price, which is about 6 cents per hour. You can see here that if I placed a bid for 3 cents an hour, it would have kept me running until just after November 1st. Since I’m paying on the actual Spot price, I would have saved about 89% over the On-Demand price.
In fact, it’s not uncommon to see savings of 70-90% for Spot Instances.
Where are Spot Instances best used?
Some applications we’ve seen for Spot Instances include scientific research, like the national labs and NASA, who are doing large, high-processing jobs. Additionally, there are big data batched jobs, like Hadoop and so forth. The third way is for batch video processing. All of these are production workloads, so there are applications there.
We do also see them used in non-production applications, such as performance and scalability testing.
Stay tuned for the next installment of the series next week.