How to Pay Less for Cloud Hosting: Using Amazon Spot Instances
Many users of Amazon Elastic Compute Cloud, or Amazon EC2, have yet to discover the cost-saving potential of Spot Instances. This pricing model allows you to bid on Amazon’s unused capacity. When capacity is high relative to demand, the price of Spot Instances can be extremely low.
Spot Instances offer a useful alternative to the other options offered by Amazon:
- On Demand Instances give you the ability to ramp your capacity rapidly up and down, paying only for the amount you use.
- Reserved Instances allow you to reserve a given amount of computing capacity with an initial up-front payment, paying a discounted rate from then on.
With On Demand and Reserved Instances, you know exactly how much you will pay for a given amount of usage—but predictability does not necessarily lead to savings. If used correctly, Spot Instances can help you eliminate a large chunk of your hosting costs.
The Magic of Spot Instances
With Spot Instances, you place a bid to make use of Amazon’s unused capacity. But you won’t necessarily pay that amount. You pay Amazon’s Spot price, which can change from minute to minute with supply and demand.
The main condition is that your bid has to stay above the Spot price, or your instances will be terminated. In order to make sure you keep your service at all times, you should place your bid several times higher than the price for On Demand Instances—just in case the Spot price leaps upward.
The good news is that this will rarely happen! The vast majority of the time, the Spot price hangs well below the price for On Demand, as you can see on websites such as www.spothistory.com, a website that tracks historical trends in Spot pricing. Most price spikes last an hour or two at most.
Crunching the Numbers
The use of Spot Instances can result massive savings. Just to pick an example, if you are running a database on a High CPU Extra Large instance in Virginia, the On Demand price is $0.68 per hour. As these words are being written, the Spot price is $0.24 per hour—less than half the cost of On Demand.
If you launch Spot Instances with a bid of $3.00 per hour, that should virtually guarantee your ability to meet any plausible spikes in the Spot price. Yet your average cost in the long run is likely to stay under $.30.
For each Virginia standard instance, the costs over three years break down this way:
- On Demand: $2,234
- Reserved: $1,138
- Spot (at average 3.5c per day): $920
Viewed from this perspective, Spot Instances look like an excellent bargain.
What About Reserved Instances?
Although On Demand is clearly more expensive than Spot Instances, Reserved Instances might turn out to be slightly cheaper in some cases. Even so, consider the other advantages of Spot Instances:
- You don’t have to pay the up-front three-year fee for Reserved Instances, which can become substantial for larger instance types.
- If you outgrow your current instance type, you can upgrade to a new one without sacrificing a three-year sunk cost, as you would with Reserved pricing.
- You will benefit from further price drops over time, instead of being possibly locked in at the Reserved pricing.
- If you don’t use the machine some of the time, you save only a fraction of your costs with Reserved Instances—but 100 percent with Spot pricing.
Remember, you can drop Spot Instances and change your service at any time. If the price structure changes so that Reserved Instances become more attractive, you can switch over then.
Using Spot Instances Wisely
The greatest risk with Spot Instances is the possibility that the Spot price will rise above your bid, and you will lose the instance. If you set your initial bid high enough, the chance of that occurring is extremely small. Even so, when Spot Instances are terminated, they are terminated suddenly and without any notice—so it’s smart to take certain precautions.
For example, the strategic use of EBS volumes and other cloud architecture techniques can lower the chance that your data will be lost or corrupted if you lose the instance. In addition, your application should be configured to restart automatically, so you don’t have to waste time and money restarting a terminated instance manually.
Are Spot Instances guaranteed to be the best solution for your hosting needs? Under certain circumstances, possibly not:
- If even a brief interruption in service, however improbable, would have major costs for your organization—as in the case of some database servers.
- If an instance is handling a large amount of rapidly changing data.
- If you need to accommodate sudden bursts in usage (since Spot Instances take slightly longer to start than Amazon’s On Demand instances).
For most purposes, however, Spot Instances are likely to be just as effective as the alternatives, at a potentially far lower cost. Whether you are a newcomer to the Amazon cloud or a long-time user, Spot pricing is an option worth exploring.