RightScale Blog

Cloud Management Blog
RightScale 2015 State of the Cloud Report
Cloud Management Blog

Bid for Your Instances!

Bid for Your Instances!

We're clearly witnessing a year-end release finale at AWS with another big release tonight: EC2 spot instance pricing. Spot instance pricing is the third pricing model introduced by Amazon after the original per-hour price (now called "on-demand"), then the "reserved" instance pricing and now a supply and demand driven "spot" pricing. As far as I know, this is the first step on a large scale towards "market pricing" for computing based on offer and demand. I know many people have been dreaming about something like this and a few startups have started to offer a compute market of some sort. But with Amazon's offering it is now available on a large scale to anyone!

How it works is simple yet complex. You can read the official product pageJeff Barr's blog, and Werner's blog. Here's my attempt at explaining it. AWS publishes a spot price for each instance size in each region. The spot price is the per-hour cost of a server and if you launch a spot price server now that's what you pay for the next hour. So instead of $0.10/hr for a small server you might only pay $0.03/hr if that's the current spot price. AWS adjusts the spot price periodically based on the idle capacity available, so the price might be low at night or week-ends when many sites auto-scale down and it might be high during the day when everything is busy.

Now comes the complex part. You don't just launch a spot instance and forget about it, you actually specify a maximum price you are willing to pay and for each hour you have your server running you pay the spot price current at the start of the hour. As the spot price continues to vary while your instance is running this maximum becomes very important because should the spot price exceed your maximum then your instance will be terminated by AWS! It's also possible to work the maximum price in reverse: specify a price lower than the current spot price in the evening and your request stays queued until the spot price drops below what you specified and AWS then automatically launches your instances. You can revise your maximum at any time, so if at 4am the spot price has not dropped enough you can raise your max so your instances get to run before sunrise.

It should be clear from the way the spot pricing functions that this is intended for transient compute capacity. For your database instances you should carefully stay with the on-demand or reserved instances, but for late night batch jobs where it doesn't matter whether they run a bit earlier or later the spot pricing can save quite some money.

One thing that is not obvious at the outset is what would motivate Amazon to keep the price down. Part of the answer lies in the fact that instances whose max bid drops below the current spot price get terminated, thus if the price goes up too much, too many instances get terminated which results in less revenue. So there is a balance between more instances at a lower price and fewer instances at a higher price. But I'm sure it's a lot more complex than that.

We will be supporting spot pricing in the RightScale platform over the coming months and we're curious about the functionality our customers would like to see in that respect. There are a lot of opportunities for automation here!


I too am wondering how AWS compute the Spot Price. A minor correction: "instances whose max bid exceeds the current spot price get terminated" You probably meant to say "whose max bid is below the current spot price".
"One thing that is not obvious at the outset is what would motivate Amazon to keep the price down." Seems like the opposite: Amazon wants the price to be high. But they would rather get paid *SOMETHING* than have the boxes sit idle. Thus, you get to run at one cent per hour, unless someone else is willing to pay two cents (and so on). I'll bet they don't terminate *ALL* the boxes when a higher bid comes in. They terminate only enough to run the higher bidders as they come in. One big unknown: If the price changes minute by minute, you could have several people startup and get immediately terminated on the same box. In this case, Amazon would collect full-hour fees from each user in a single hour! Hopefully Amazon doesn't do this and/or has a good algorithim for selecting which box to terminate. Also, having a maximum price (8 or 10 cents an hour) seems like a bad thing for Amazon, but a really good thing for customers.
Posted by Anonymouse (not verified)   Ι   December 14, 2009   Ι   09:11 AM
Response by Anonymouse (not verified)   Ι   December 14, 2009   Ι   09:33 AM
Oops, my "big unknown" can't happen (they don't charge for partial hour if your instance gets terminated by them). The original article still seems wrong when it says "So there is a balance between more instances at a lower price and fewer instances at a higher price." I think this is designed so that all boxes will always be running (assuming there are lots of people willing to pay 1 cent). The way I see it: The spot price is the current lowest bidder running. If you bid above the spot price you will take over one of those lowest bidder boxes (but still pay the spot price, not your bid). If someone takes over the last "lowest bidder" box at the spot price, then the spot price goes up (and everyone pays higher rates).
If the spot price doesn't go above your instance max bid then Amazon can't terminate your instance. So your notion of "you will take over one of those lowest bidder boxes but still pay the spot price" is incorrect.
The spot price is public. They're pretty clear that if your instance's max bid is X and the spot price is >X then your instance will be terminated. It's not clear how quick the terminate occurs, i.e. whether there is some leeway there or not. So if there are 10 instance at $1 running and one max bid at $2 comes in they can's simply boot off one of the 10 to run the $2/hr one. Everyone also pays the same price, it's really not as simple as you make it. In terms of Amazon collecting multiple full-hours fees per hour: they're clear about that. If you stop a server part way throu an hour you pay for the hour (it has always been like that), but if they stop your server part way through the hour you do NOT pay for the the hour at all! So there's a dis-incentive for them to kill servers at the wrong time...
Anonymouse: Spot Instances are charged differently: You're not charged at all for the partial hour if the Spot Instance was terminated forcibly by the Spot Instances mechanism (when it was out-bid by another bidder). Only full hours are charged, or partial hours where your instance terminated "normally". So at least there's no financial incentive for Amazon to do as you describe.
Could the spot price go above the on-demand price? If the spot price does not, then setting the spot price maximum at the on-demand price would (in theory) save money as the most you would pay is what you would pay on-demand anyway. Your savings would come when the spot price is lower. If the spot price does not go higher than the on-demand price, the spot instance would never be terminated if the maximum is set to the on-demand price.
The spot price can indeed exceed the on-demand price. The way I think about it is that when capacity becomes tight AWS really needs to stop disposable (spot) capacity to make room for required (on-demand) capacity. Also, your account has a higher default spot instance allowance than on-demand instance allowance (I believe 100 spot instances vs. 20 on-demand).
Response by Patrice (not verified)   Ι   March 15, 2010   Ι   01:51 PM
From the current history, it looks like you can ask for a spot instance with a max price close to the on-demand pricing and end up having a permanent instance running at 40-60% discount... Getting interesting for added capacity in a server group (mixing on-demand for availability and spot for low-price: worst case you end-up launching on-demand instances if spot instances become unavailable. Of course if a lot of people start to do that, the price will go up! Oops, I just revealed the secret.
Patrice, what you describe has been mentioned many times, so you didn't let any secret out the bag ;-) There are at least two issues. The first is that this scheme will become less and less interesting as more people use it and the prices rise as a result. The second is that if you price all servers the same, then as the price rises all your servers will be terminated at once, which may be pretty hard to recover from. It seems a lot better to use a price distribution such that they get stopped more gradually as the price rises.
[...] Amazon Spot Instances appears to be “the first step on a large scale towards ‘market pricing’ for computing based on offer and demand,” the company RightScale, which provides services around the Amazon cloud platform, writes in its official blog. [...]
There is a fairly significant price difference between US East ($0.05 - c1.m) and West ($0.082 - c1.m) . I find it interesting that a medium instance would be worth 3 cents a minute more on the West coast. Does this indicate a much higher demand for West instances or more limited supply of servers?
Posted by Iolaire McFadden (not verified)   Ι   December 25, 2009   Ι   10:04 AM
I don't have much visibility into this, but AWS has been clear about the fact that the operating cost in us-west is higher. Something that may be at play here is that we've seen quite a shift towards larger instance sizes, so it could be that there is excess smallish instance capacity available in east but not in west, since that has been configured much more recently. But this is just speculation.
Is there a facility offered by Rightscale or others that would allow you to migrate your instance automatically without loss or data or processing to a higher priced server if your current limit is exceeded? In much the same way as ebay bids can be configured to persist until the auction closes but your bid only increases to the next price/bid level rather that pushes straight to the max bid? Excuse my ignorance if this is part of the functionality provided by AWS.
Posted by Billy LePoisson (not verified)   Ι   February 10, 2010   Ι   04:02 AM
Billy, what you describe is not something we currently offer, but you may also be misunderstanding how the spot price works. It's very similar to ebay in that you enter your max price, so if you enter $0.10/hr and the spot price is $0.04/hr you will only pay the latter $0.04/hr. You should thus enter the max price you're comfortable with. What Amazon doesn't offer is to say "please convert my instance to an on-demand when the spot price exceeds the on-demand price". You can put all your data on an EBS volume and relaunch the server as an on-demand server from that volume, but that's not a transparent operation. We are working on schemes like that, but focused on arrays of servers rather than individual ones.
[...] For more details and background information visit the Amazon EC2 Spot Instance detail page, the AWS developer blog and the good folks at RightScale. [...]
Hi all, I have been working on a scheme for delivering highly available services (subject to performance constraints such as response time) using AWS spot instances. The proposal relies on two components: (i) a price prediction model aimed at determining the lowest limit price to bid in order to achieve a given level of availability (e.g., 99.999%); and (ii) a dynamic policy for server allocation and admission control based on estimates of traffic parameters. An overview of the model is described here http://cloud-computing-economics.com/business-benefits-applications/delivering-reliable-services-spot-instances/ while more details are reported here http://math.ut.ee/~mazzucco/papers/hpcc_2011.pdf

Post a comment