Spot Instances enable you to rent spare EC2 compute capacity at a fraction of the cost of On-Demand. They can be interrupted at any time, but when used in an auto scaling group they make for a great replacement for On-Demand.
Spot Instance Pricing Is Mostly Static Nowadays
In the past, Spot Instances worked a lot like the stock market. AWS customers would bid on a price they wanted their instance to run at, and the instance would run for as long as that price was available. It caused prices to fluctuate like crazy throughout the day, sometimes even being priced higher than On-Demand when demand was high.
AWS changed this, and now Spot Instances have a mostly fixed price. With the new model, you can simply set a maximum price that you are willing to pay, and you will be charged whatever the current Spot price is for that hour.
The price can still change a bit, but AWS is huge, and has a lot of compute capacity. Unless some corporate entity is renting out their entire capacity, the price doesn’t really fluctuate at all. For nearly every instance type, fluctuations are only visible over the course of a whole month, and even then, it almost never gets close to the On-Demand price.
You can view Spot Instance prices yourself from the EC2 console by clicking on “Spot Requests” in the sidebar and opening up the “Pricing History” dialog.
You can browse around, and you’ll see that most instances are almost entirely static from day-to-day. Fluctuations will only be visible over the course of weeks and months. The c5.large instance is a fairly popular one and sees a bit of fluctuation, but it mostly stays the same:
Other instances, like r5.4xlarge, may fluctuate a bit more, but usually don’t get close to the On-Demand price.
Other instances, particularly the T2/T3 lineup, don’t really fluctuate at all, maybe by a few cents every week. AWS has more than enough capacity to meet the needs of every Spot Instance user at a bargain price, and this is the price at which they want to sell the electricity costs.
You can use Spot Instances just like you’d use regular EC2 instances. You’ll usually launch a fleet of them with an auto scaling group, where if an instance is reclaimed by AWS, a new one can be spun up quickly.
In general, the price for Spot Instances is usually at least 50% of the On-Demand price, with most instance types hovering around 60-70% or so. AWS’s claim of “up to 90% cost savings” really emphasizes the “up to.” The only instances you’ll find at 90% cost savings are previous generation instances like c1.medium, as an easy way for AWS to sell off their older hardware.
This consistent cost savings positions Spot Instances in a great spot. They offer about same price savings as Reserved Instances (and are occasionally a bit cheaper), while not having the 1- or 3-year contract associated with it. If your server lifecycle can be easily automated to make use of Auto Scaling, you probably don’t mind if you have to restart 1 server out of a fleet of 10.
This isn’t to say Spot Instances will be randomly terminated all the time—interruptions are actually quite rare. In any given month, the average termination rate is 5%, meaning you probably won’t see any frequent interruptions unless you’re running a lot of instances. (In which case, you can probably handle them.) You’ll still have to plan for interruptions, as it’s a non-zero chance, and the chance is higher on some types of instances. You can view the interruption rate for your instance on AWS’s Spot Instance Advisor calculator.
You’re given two minutes of notice anyway, which is enough time for your auto scaling group to start up a new one with minimal interruptions. We would still recommend having at least two instances in an autoscaling group to prevent service interruptions entirely.