Confused by Amazon EC2 Spot Price and On-demand price, help needed
Solution 1:
It is my understanding that Spot Instance pricing can be higher than On-Demand pricing in the case where a few users put in a high price to get access to a large number of servers for a short amount of time (usually only 1 hour). See page 18 of the Introduction to Spot Instances document:
Access Large Pools of Compute Capacity: Spot Instances can be used to help you meet occasional needs for large amounts of compute capacity (note that the default limit for Spot Instances is 100 versus the default limit of 20 for On-Demand Instances.) If your needs are urgent, you can specify a high maximum price (possibly even higher than the On-Demand price), which will raise your request’s relative priority and allow you to gain access to as much immediate capacity as possible given other requests and the Spot Instance capacity available at the time. While Spot Instances are generally not suitable for steadystate tasks such as serving web content, they can be used as a valuable source of instance capacity even for steady state applications when applications have urgent computing needs due to unanticipated or short-term demand spikes.
You can read more about spot instances and On-Demand vs Reserved vs Spot but basically here are your options:
If you need an always-on server for a long period of time (1 year or 3 years) choose a Reserved Instance for a "bulk discount". By paying up front Amazon can better estimate capacity needs and will guarantee that your server is available for the specified amount of time.
If you need a server that is always-on but for less than 1 year choose a On-Demand instance for your primary or master nodes. These take precedence over Spot instances and are almost always available whenever needed (up to 20, as indicated above). Once your instance is running it will not be terminated by Amazon unless the node has a hardware issue, in which case you will be moved to another node.
If your workload can benefit from extra instances but you do not want to pay the full On-Demand price then you can request Spot Instances for secondary or slave nodes. Spot instances are priced based on excess EC2 supply and spot instance demand, both of which are highly dynamic. There is no guarantee that a spot instance will run (even with a price higher than the On-Demand price), and your server instance can be terminated by Amazon at anytime (to be used by a higher paying Spot instance or an On-Demand instance). This requires your process to be re-entrant and that you save your work frequently.
Solution 2:
Greg explained the details vey well, but I just wanted to add some notes based on my experience with spot priced instances.
If you use the Amazon AWS Console to launch your spot priced instance, there's a link where you can check the current spot price and see how it has been fluctuating over time. In most cases, if you bid somewhere between the current spot price and the on-demand price, you'll get your instance within half an hour or so (note that in my experience it defintely takes a bit longer to get a spot priced instance compared to an on-demand instance). This method should be fine for short-lived instances, as long as you don't need them right away (for example, if you want to fire up additional instances to cope with fluctuations in load on a web site, you will need to take the increased startup time into account.
Be careful about bidding above the on-demand price, especially if you want to start multiple instances. You might think this will guarantee you a running instance, but I've seen this practice actually drive up the current spot price.