Why would I use a spot instance when purchasing an Amazon EC2 instance if it might be taken away from me?
- On-demand instance
- An on-demand EC2 instance is a fixed price-per-hour and is the most expensive way to run a server.
- At the time of writing, an Amazon Linux m3.medium costs $0.077 per hour
- Reserved instance
- A reserved instance lets you save a bit of money on the per-hour cost by paying an up-front cost. These are great if you can predict your usage (light, medium or heavy) over either 12 or 36 months.
- Currently, an Amazon Linux m3.medium, if you will be a heavy (always on) user costs $222 up front and $0.028 per hour for 12 months.
- Spot instance
- Spot instances are a little different. The price for spot instances varies a lot and is driven by the market. The downside, as mentioned in the question, is that any spot instance you request may be terminated (not simply stopped) at any point without warning.
- Currently, any Linux m3.medium instance costs $0.0101 per hour; more than seven times cheaper than on-demand and less than half the cost of a heavy usage reserved instance without any up-front cost.
So where's the advantage? Is the risk of termination of an instance greater than the potential saving? Well, as ever with these sorts of questions, that depends. Certainly you wouldn't want to run your entire customer-facing Web presence on spot instances, but that shouldn't mean you rule it out. By using Amazon's autoscaling feature with a combination of on-demand and spot instances, Pinterest has managed to reduce its average hourly infrastructure costs from $54 to $20, growing and shrinking to react to traffic spikes.
Managing the autoscaling groups needed for a combination of on-demand and spot instances unlocks a lot of potential savings, but has an initial cost of modifying your application to make the best use of this kind of elasticity.
Another good use of spot instances, which many businesses may find more immediately useful, is in batch processing, traditionally done using off-peak time on the server overnight or on weekends. Data grid products like Oracle Coherence lend themselves very well to massively parallel computing like MapReduce and can be very resilient to nodes being added or removed, perfect to make use of Amazon's hard-to-predict spot instances.
Dig Deeper on AWS instances strategy and setup
Related Q&A from Steve Millidge
Learn the differences between HVM and PV for Amazon Machine Images. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.