When Should You Use AWS Spot Instances?
Many organizations use a combination of Reserved Instances, On-Demand Instances, SavingsPlans and Spot Instances to support their applications and manage their costs. While Spot Instances are too unpredictable for most web servers and databases, they are a great way to save money on flexible or fault-tolerant tasks and add capacity to existing resources.
Let’s take a closer look at spot instances, how to use them to lower your costs, and how they fit into the bigger picture.
What Are Spot Instances?
Spot Instances are spare compute capacity that’s available at a steep discount to On-Demand Instances and Reserved Instances. While they are frequently used to supplement On-Demand Instances, they aren’t meant to handle 100% of your workload due to the potential for service disruption with very little notice.
The price of a Spot Instance varies depending on supply and demand at any given time, but discounts of up to 90% off of On-Demand Instances aren’t unusual. Some companies have saved up to 75% on their EC2 costs by shifting purely to Spot Instances using creative engineering practices, although most organizations use them for specific tasks.
You can compare the cost savings of Spot Instances over On-Demand Instances using AWS’ Spot Instance Advisor. The tool helps you instantly find pools with a minimal chance of interruption and shows you the potential savings over related On-Demand Instances. You can also specify region, OS, vCPU and memory criteria to find specific options.
The catch is that Spot Instances can be reassigned with only minutes of advanced notice if the bid isn’t high enough or if AWS requires the instance to meet On-Demand Instance demand. For example, AWS may recall these instances with little notice during holidays like Black Friday where there’s a significant spike in demand.
When to Use Them
Spot Instances are well-suited for fault-tolerant and flexible applications, such as continuous integration pipelines or Hadoop data processing tasks. They may also be helpful for workloads that constantly save data to persistent storage, such as Amazon’s S3, or to add capacity to infrastructure that’s already running on On-Demand Instances.
Download our Checklist of Spot Instance Optimization Tools to see how you can optimize your SI usage without relying on EC2 Auto Scaling’s complexity.
One of the most common use cases for Spot Instances is batch processing tasks. For example, suppose that you want to automate content rendering workloads and reduce the need for human intervention. You could use AWS Batch with Spot Instances to scale rendering at significantly less cost than using On-Demand Instances.
Continuous integration (CI) and large-scale testing tasks are another common use case for Spot Instances since testing and development can consume upwards of 60% of cloud environments. Since CI tasks run on an infrequent schedule, full-time Reserved Instances are overkill and On-Demand Instances can be pricey.
High-performance computing is yet another area where Spot Instances can be helpful for saving money. For instance, machine learning or artificial intelligence-powered recommendation engines require days of training on a GPU rather than a CPU. The cost of GPU instances can quickly spiral out of control, making Spot Instances a great option.
Some other common use cases include:
- Web services
- Image rendering
- Big data analytics
- Parallel computation
- Big data analytics
- Machine learning
- Video transcoding
- CI/CD development
The best approach is to pair each use case with the ideal instance type. For example, an organization may have 60% Reserved Instances for critical tasks, 30% On-Demand Instances for flex capacity, and 10% Spot Instances to cover specific fault-tolerant tasks like data processing or media rendering on an on-demand basis.
If you have a unique use case and have a question about Spot Instances, we’d love to hear about it! Get in touch with Francois at [email protected].
When to Avoid Them
Spot Instances are not a good choice for sensitive workloads, databases or client-facing systems that require dedicated resources or can’t recover. For example, you shouldn’t use them for queues, caches or databases since these processes are rarely fault-tolerant. The same is true for many web servers or backend APIs where up-time is critical.
While Spot Instances may be ideal for CI tasks and testing, they can cause problems when used for development purposes. Spot Instances can go down with very little notice and potentially cause a developer to lose their work. These issues can be mitigated if you use robust backup and recovery solutions.
Finally, companies with limited DevOps resources may want to avoid the headache of Spot Instances. EC2 Auto Scaling makes it possible to optimize workload cost with performance, but it requires a lot of configuration and isn’t exactly a hands-off process — it requires some expertise and ongoing management resources.
Spot Instance Best Practices
There are several factors to keep in mind if you choose to use spot instances in staging, testing or production environments. By keeping these tips in mind, you can avoid many of the complexities associated with building and managing Spot Instances, as well as save time and money over the long run as you incorporate them into your workflows.
The most important best practices include:
- Use Spot Fleets – Spot Fleets are collections of Spot Instances that automatically launch to meet a target capacity and budget defined in the request. They make it a lot easier to manage Spot Instances in the aggregate.
- Seek Stability – Some Spot Instances have less price volatility than others, such as older generation instance types or those located in different zones. Try to choose these Spot Instances to avoid unexpected price increases.
- Ensure Continuity – EC2 Spot Instances can be configured to hibernate, meaning that they can pause and resume as capacity becomes available. That way, the application can gracefully pause rather than suddenly crash.
The Bottom Line
Spot Instances could play an important role in lowering your AWS costs. In addition to the common use cases we’ve covered above, you may want to explore ways to use it in production web servers to realize significant savings or other unconventional strategies that might make sense for your specific situation.
We are here to help if you have any questions about spot instances or want to learn more about a particular use case that you have in mind. Contact Francois at [email protected] to ask any questions and we’re happy to help you out!
Beyond utilizing Spot Instances, CloudForecast enables you to understand your overall AWS costs at a glance. You can quickly see where cost overruns are occurring and generate reporting for C-Level executives that require higher level overviews. Spot Instances are just one part of wider cost management.
[Sign up for a free 30-day trial today!](https://app.cloudforecast.io/users/sign_up?utm_source=blog&utm_medium=link&utm_campaign=aws spot instances)
Manage, track, and report your AWS spending in seconds — not hours
CloudForecast’s focused daily AWS cost monitoring reports to help busy engineering teams understand their AWS costs, rapidly respond to any overspends, and promote opportunities to save costs.
Monitor & Manage AWS Cost in Seconds — Not Hours
CloudForecast makes the tedious work of AWS cost monitoring less tedious.
AWS cost management is easy with CloudForecast
We would love to learn more about the problems you are facing around AWS cost. Connect with us directly and we’ll schedule a time to chat!