AWS offers a number of discount options for their cloud resources, of which one of the more interesting is AWS spot instances. Spot instances offer an alluring discount for spare capacity – but of course, this purchasing option can’t be used the same way as on demand infrastructure. Here are seven things you should know about AWS spot instances, which may help you decide whether or not you should be using them.
1. What Spot Instances Are
AWS spot instances are not a specific type of instance – rather, this is the name of a purchasing option that allows users to take advantage of spare capacity at a low price, with the possibility that it could be reclaimed for other workloads with just a two minute notice. If the price goes above your maximum set price, your workload will also be interrupted.
This means that workloads need to be specifically designed for fault tolerance, though AWS claims that spot instances are interrupted less than 5% of the time. With spot instance hibernation, interrupted instances need not be terminated. Rather, they can be essentially paused, with the memory saved to the root EBS volume, then reloaded when the machine is resumed.
2. Best Practice: Spot Fleets
Spot Fleets are collections of instances, including Spot Instances and optionally On Demand instances. When provisioning a spot fleet, you can set a target capacity for the fleet, and the request will be fulfilled if there is available capacity.
AWS recommends Spot Fleets as a best practice. One reason is that you can use fleets to request multiple instance types simultaneously – which not only increases the likelihood that your request is filled, but can mitigate cost risks by setting a maximum cost per hour for the whole fleet rather than a specific spot pool (group of instances with the same instance type, operating system, availability zone, and network platform).
3. When to Use AWS Spot Instances
Since Spot Instances are interruptible, you’ll need to limit your usage of them to fault-tolerant workloads.
Time critical workloads should have instances be automatically replaced, either by restarting workloads on a new instance, or for production websites, send users to a different instance using a load balancer.
Common use cases for spot instances include:
- Batch processing
- Web services
- CI/CD development
- Hadoop data processing
- Image rendering
- Big data analytics
- Machine learning
- Video transcoding
- Massively parallel computations
AWS recently announced that spot instances will now be available in US GovCloud regions, putting them available in 21 regions and 66 availability zones. They’re only available for EC2 instances.
If you’ve read any older (pre-fall-2017) articles about Spot Instances, you’ll see a lot of talk about bidding strategies and spikes in pricing. AWS seems to have listened to customers’ complaints that this system was confusing, and in response, they changed the pricing mechanism in November 2017. Now, spot instance prices do still adjust based on trends, but these trends are longer term and gradual. There is no bidding function. Instead, you pay the spot price that’s in effect for the current hour, with the option to set a maximum price you are willing to pay.
6. Savings Potential
To compare current savings over on demand pricing, you’ll want to visit AWS’s spot instance advisor. A quick check shows savings largely in the 70-80% range for Linux OS and in the 40-50% range for Windows OS, with a few instance types showing anomalies at 0% savings.
For longer-running systems, reserved instances or on demand instances with on/off schedules may be better, so you should evaluate the savings rate for all three based on the workload.
When determining whether this amount of savings will be worthwhile, remember to consider any labor costs of building and maintaining your application to tolerate interruptions.
7. How AWS’s Option Compares to Other Clouds
It’s always worth considering how the major cloud providers approach similar offerings. Comparable to AWS spot instances, Microsoft Azure has low priority VMs while Google Cloud offers preemptible VMs. As the names of both of these offerings highlight, they, too, are interruptible instances offered at a discount.
There are a few main differences to highlight. Both Azure and Google offer fixed discounting structures, offering clarity and predictability on pricing. Google’s offering is a bit more flexible, with no limitations on the instance types. On the other hand, Azure users report issues with scaling to large numbers of VMs, with many VM types having limited availability. You also must launch in Batch/Scale Sets, with no option for an individual VM.
Should You Adopt an AWS Spot Instance Strategy?
Whether you adopt an AWS spot instance-focused strategy depends on your workloads, your application, and your expertise. But if you can address the issues of fault tolerance, then most likely, yes: the savings from spot instances will be worth your while.