Answers: <p>A useful bit of information for understanding <em>why</em> someone would bid over the on-demand price can be found in the <a href="https://aws.amazon.com/items/3260?externalID=3260" rel="noreferrer">Introduction to Spot Instances</a>:</p>
  
  <blockquote>
    <p>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. </p>
  </blockquote>
  
  <p>If you have a huge spike in demand for your service (perhaps being linked to from another popular site—see the <a href="https://en.wikipedia.org/wiki/Slashdot_effect" rel="noreferrer">Slashdot effect</a>), bidding above the on-demand price for a spot instance would help you to get access to far more instances, as noted by the document.</p>
  
  <p>Of course, this isn't sustainable in the long run, and you'd get a much better deal for a long-term compute by just buying on-demand instances (plus there's less risk of being outbid!).</p>
  
  <p>If you're in a situation where you need <strong>a lot of computing power, <em>fast</em></strong>—more than you could get from just buying on-demand instances—overbidding might make sense.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-10-04T16:33:53.830Z
Answers: The linked documentation does not exist any longer. Thus one could assume that the described behaviour ("relative priority" etc. ) is no longer true.
Answers: rwitzel
Answers: CC BY-SA 3.0
Answers: 2017-04-15T09:57:30.340Z
Answers: 2017-04-15T09:57:30.340Z
Answers: Aurora0001
Answers: <p>If you look at the charts closely, you will see that a spike is always of a very short duration - just enough time for the automated monitoring systems written by the owner to terminate those systems gracefully.  In addition, you will occasionally find that the price drops down to 0 immediately following a spike.  That is because all systems in that data center are in use as on demand systems, with no systems available for spot pricing the price is effectively zero.</p>
  
  <p>When your spot instance flagged for termination, a message indicating this will be available on the system at the local meta-data uri of <a href="http://169.254.169.254/latest/meta-data/spot/termination-time" rel="noreferrer">http://169.254.169.254/latest/meta-data/spot/termination-time</a>.  There will be <strong>3 minutes</strong> until it terminates.  More then enough time in most cases to handle termination automatically.  Bidding above the demand price is only necessary for deployments which require more then a few minutes to terminate gracefully.</p>
  
  <p>If it is not possible to design your system to terminate gracefully, archive data, etc in 3 minutes you can place a bid higher then the demand price to gain time. The system can even be designed to proactively monitor the current spot price and swap over before the price goes over.  But for those times it does, you will need to make a business decision on how much it is worth for the time to terminate gracefully.</p>
  
  <p>It is foolish to pay $100/hour for 4-5 hours in order to keep your system.  However, if it will take your system 30 minutes to terminate all the processes gracefully, you can make a business decision how much it is worth to potentially lose any data, or degrade your horizontally scaled service.   An e-commerce site with a net profit of $10,000 an hour can certainly afford to pay $1000 to keep 2 spot instances running for 15 to 30 minutes while bringing up demand systems and archiving data.</p>
  
  <p>Web based application can use Elastic Load Balancer to help in addressing termination automatically. A smart implementor would put in place a set of scripts to handle the alert.  They could maintain 2 low cost on demand instances which are load balanced - and then use up to half a dozen medium cost systems via spot instances to maintain high performance and spend less then a single on demand system of the same capacity.   </p>
  
  <p>Leave 3 of them paying up to $100/hour and 3 of them paying only up to half the on demand price.  As AWS terminates instances, ELB will adjust automatically.  Giving the automated system up to an hour to adjust for a mere $200.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-06-23T16:05:21.790Z
Answers: 2017-06-23T16:05:21.790Z
Answers: garyamort
Answers: <p>There are 2 reasons for this:</p>
  
  <ul>
  <li><p>A lot of users are using the spot instance at some times (Think about batch processing, boot up 100 machines as spot instance and crunch away).</p></li>
  <li><p>For a spot instance you don't pay the bidding price, you pay the current spot price. The bidding price is the cutoff point. If the current spot price exceeds that of the bidding price AWS will terminate that instance.</p></li>
  </ul>
  
  <p>This last on is also the reason that some user will massively overbid on the spot prices. They don't want their instance to shutdown every so often, so they bid a price so high that the spot price will never reach. Since they will only pay the current spot price the instance will be much cheaper 99% of the time.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-04-15T08:02:35.037Z
Answers: So, in this picture in my question, the spot price is $2.15 at 18:00, right?  which means people are still paying $2.15 for an instance, when they can pay the on-demand price.  Why so?
Answers: Dawny33
Answers: CC BY-SA 3.0
Answers: 2017-04-15T08:11:14.737Z
Answers: see my answer (About to post it)
Answers: Henry
Answers: CC BY-SA 3.0
Answers: 2017-04-15T19:26:50.340Z
Answers: @Dawny33 Sometimes the price only rises above the threshold for a brief time. Switching from spot to on demand pricing involves recreating the instance on a normal ec2 instance. If the price drops again, the on-demand instance has be destroyed, new spot instance, ect ... Thus loosing time the instance could be doing useful. Some people won't think this is worth the effort and will only use the spot instances
Answers: Thern
Answers: CC BY-SA 3.0
Answers: 2017-04-15T07:53:54.547Z
Answers: 2017-04-15T07:53:54.547Z
Answers: Thern
Answers: <p>This is actually a great example of people slightly abusing spot. People are saying 'Our workload is really important but we don't want to pay full on demand price', so they set a bid price higher than on-demand on the assumption that it is very unlikely to be terminated, but still want to get the 'cheapest possible' spot price on offer.</p>
  
  <p>There have been cases where people enter, for example, $1000 (I've been told of at least one time this happened) because they want the benefit of the spot market. Of course naturally at some point the demand comes in and the spot price SOARS to make people pay higher than on-demand.</p>
  
  <p>The way the spot market works is that Amazon have X instances spare capacity, and they count from the top down until they fill the need for all X instances. The 'price', then, is the lowest price at which they can fulfill those X instances.</p>
  
  <p>So imagine Amazon have 10,000 instances - well they will count down to (say) $0.43 until they've got those 10,000 instances fulfilled. But if that supply suddenly drops to 100 instances, then maybe a few people put bid prices of $10,000 for their 100 instances, suddenly they'll be paying that $10k per hour.</p>
  
  <p>Tl;dr Understand how spot works, and set a cap you are prepared to pay.</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-10-04T16:34:53.117Z
Answers: Is there official documentation that supports your view on how spot works? Or some unofficial documentation at least?
Answers: rwitzel
Answers: CC BY-SA 3.0
Answers: 2017-04-15T08:14:08.237Z
Answers: 2017-04-15T08:14:08.237Z
Answers: Henry
Body: <p>I was trying to provision spot instances via Ansible yesterday, and almost all my requests failed, even when I put my spot price == the on-demand price of that instance. </p>
  
  <p>So, when I had a look at the spot pricing graph, I found something very interesting:</p>
  
  <blockquote>
    <p><a href="https://i.sstatic.net/2Pfb9.png" rel="noreferrer"><img src="https://i.sstatic.net/2Pfb9.png" alt="enter image description here"></a></p>
  </blockquote>
  
  <p>The spot price of the instance in us-east-1a is more than the on-demand price, which confused me. [in fact, ~5x times higher]</p>
  
  <p><strong>Aren't spot instances preferred for the low cost?</strong> If yes, then why is the price higher than the on-demand price?</p>
  
  <p>According to <a href="https://aws.amazon.com/ec2/spot/pricing/" rel="noreferrer">AWS's docs</a>:</p>
  
  <blockquote>
    <p>Spot instances provide you with access to unused Amazon EC2 capacity
    at steep discounts relative to On-Demand prices.</p>
  </blockquote>
  
  <p>Also, <strong>does this mean that people are bidding over the on-demand price?</strong>  If yes, then why so?  Aren't they better off with an on-demand instance?</p>
  
  <p>Or did I understand the concept of spot instances wrong?</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-04-16T01:08:47.703Z
Comments: If the spot price was always less than the on-demand price, why would the on-demand price exist at all?
Comments: Zach Lipton
Comments: CC BY-SA 3.0
Comments: 2017-04-16T02:11:09.783Z
Comments: Zach, because Amazon can terminate your instance at will if there's a higher bidder.
Comments: Xiong Chiamiov
Comments: CC BY-SA 4.0
Comments: 2019-04-22T09:38:58.573Z
Comments: No matter what is the reason behind it - you can minimize the risk by implementing the best practice rules for spot instances - https://aws.amazon.com/ec2/spot/getting-started/ - create the request for as many instance types and as many AZs as possible, that way you can mitigate the possibility that you will pay more. If you pay a bit more in a fraction of time and substantially less in all other cases this is still beneficial to you. Also, it looks like the algorithm with many small instances can be much safer that big single node workloads https://aws.amazon.com/ec2/spot/instance-advisor/
Comments: petrchpetr
Tags: <amazon-web-services><amazon-ec2>
Title: Why is the AWS EC2's spot price greater than the on-demand price?
UserDisplayName: Dawny33
ThreadText: # Why is the AWS EC2's spot price greater than the on-demand price?
  
  (Asked by: username_0 on 2017-04-15)
  
  I was trying to provision spot instances via Ansible yesterday, and almost all my requests failed, even when I put my spot price == the on-demand price of that instance.
  
  So, when I had a look at the spot pricing graph, I found something very interesting:
  
  > [![enter image description here](https://i.sstatic.net/2Pfb9.png)](https://i.sstatic.net/2Pfb9.png)
  
  The spot price of the instance in us-east-1a is more than the on-demand price, which confused me. [in fact, ~5x times higher]
  
  **Aren't spot instances preferred for the low cost?** If yes, then why is the price higher than the on-demand price?
  
  According to [AWS's docs](https://aws.amazon.com/ec2/spot/pricing/):
  
  > Spot instances provide you with access to unused Amazon EC2 capacity
  > at steep discounts relative to On-Demand prices.
  
  Also, **does this mean that people are bidding over the on-demand price?** If yes, then why so? Aren't they better off with an on-demand instance?
  
  Or did I understand the concept of spot instances wrong?
  
  **Tags:** amazon-web-services, amazon-ec2
  
  > **Comments:**
  > **username_1**: If the spot price was always less than the on-demand price, why would the on-demand price exist at all?  
  > **username_2**: username_1, because Amazon can terminate your instance at will if there's a higher bidder.  
  > **username_3**: No matter what is the reason behind it - you can minimize the risk by implementing the best practice rules for spot instances - https://aws.amazon.com/ec2/spot/getting-started/ - create the request for as many instance types and as many AZs as possible, that way you can mitigate the possibility that you will pay more. If you pay a bit more in a fraction of time and substantially less in all other cases this is still beneficial to you. Also, it looks like the algorithm with many small instances can be much safer that big single node workloads https://aws.amazon.com/ec2/spot/instance-advisor/  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_8 on 2017-04-15. Score: 31 | Accepted answer
  
  This is actually a great example of people slightly abusing spot. People are saying 'Our workload is really important but we don't want to pay full on demand price', so they set a bid price higher than on-demand on the assumption that it is very unlikely to be terminated, but still want to get the 'cheapest possible' spot price on offer.
  
  There have been cases where people enter, for example, $1000 (I've been told of at least one time this happened) because they want the benefit of the spot market. Of course naturally at some point the demand comes in and the spot price SOARS to make people pay higher than on-demand.
  
  The way the spot market works is that Amazon have X instances spare capacity, and they count from the top down until they fill the need for all X instances. The 'price', then, is the lowest price at which they can fulfill those X instances.
  
  So imagine Amazon have 10,000 instances - well they will count down to (say) $0.43 until they've got those 10,000 instances fulfilled. But if that supply suddenly drops to 100 instances, then maybe a few people put bid prices of $10,000 for their 100 instances, suddenly they'll be paying that $10k per hour.
  
  Tl;dr Understand how spot works, and set a cap you are prepared to pay.
  
  > **Comments:**
  > **username_5**: Is there official documentation that supports your view on how spot works? Or some unofficial documentation at least?  
  
  ---
  
  ### Answer by username_7 on 2017-04-15. Score: 13
  
  There are 2 reasons for this:
  
  * A lot of users are using the spot instance at some times (Think about batch processing, boot up 100 machines as spot instance and crunch away).
  * For a spot instance you don't pay the bidding price, you pay the current spot price. The bidding price is the cutoff point. If the current spot price exceeds that of the bidding price AWS will terminate that instance.
  
  This last on is also the reason that some user will massively overbid on the spot prices. They don't want their instance to shutdown every so often, so they bid a price so high that the spot price will never reach. Since they will only pay the current spot price the instance will be much cheaper 99% of the time.
  
  > **Comments:**
  > **username_0**: So, in this picture in my question, the spot price is $2.15 at 18:00, right?  which means people are still paying $2.15 for an instance, when they can pay the on-demand price.  Why so?  
  > **username_8**: see my answer (About to post it)  
  > **username_7**: @username_0 Sometimes the price only rises above the threshold for a brief time. Switching from spot to on demand pricing involves recreating the instance on a normal ec2 instance. If the price drops again, the on-demand instance has be destroyed, new spot instance, ect ... Thus loosing time the instance could be doing useful. Some people won't think this is worth the effort and will only use the spot instances  
  
  ---
  
  ### Answer by username_4 on 2017-04-15. Score: 8
  
  A useful bit of information for understanding *why* someone would bid over the on-demand price can be found in the [Introduction to Spot Instances](https://aws.amazon.com/items/3260?externalID=3260):
  
  > 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.
  
  If you have a huge spike in demand for your service (perhaps being linked to from another popular site—see the [Slashdot effect](https://en.wikipedia.org/wiki/Slashdot_effect)), bidding above the on-demand price for a spot instance would help you to get access to far more instances, as noted by the document.
  
  Of course, this isn't sustainable in the long run, and you'd get a much better deal for a long-term compute by just buying on-demand instances (plus there's less risk of being outbid!).
  
  If you're in a situation where you need **a lot of computing power, *fast***—more than you could get from just buying on-demand instances—overbidding might make sense.
  
  > **Comments:**
  > **username_5**: The linked documentation does not exist any longer. Thus one could assume that the described behaviour ("relative priority" etc. ) is no longer true.  
  
  ---
  
  ### Answer by username_6 on 2017-06-23. Score: 5
  
  If you look at the charts closely, you will see that a spike is always of a very short duration - just enough time for the automated monitoring systems written by the owner to terminate those systems gracefully. In addition, you will occasionally find that the price drops down to 0 immediately following a spike. That is because all systems in that data center are in use as on demand systems, with no systems available for spot pricing the price is effectively zero.
  
  When your spot instance flagged for termination, a message indicating this will be available on the system at the local meta-data uri of <http://169.254.169.254/latest/meta-data/spot/termination-time>. There will be **3 minutes** until it terminates. More then enough time in most cases to handle termination automatically. Bidding above the demand price is only necessary for deployments which require more then a few minutes to terminate gracefully.
  
  If it is not possible to design your system to terminate gracefully, archive data, etc in 3 minutes you can place a bid higher then the demand price to gain time. The system can even be designed to proactively monitor the current spot price and swap over before the price goes over. But for those times it does, you will need to make a business decision on how much it is worth for the time to terminate gracefully.
  
  It is foolish to pay $100/hour for 4-5 hours in order to keep your system. However, if it will take your system 30 minutes to terminate all the processes gracefully, you can make a business decision how much it is worth to potentially lose any data, or degrade your horizontally scaled service. An e-commerce site with a net profit of $10,000 an hour can certainly afford to pay $1000 to keep 2 spot instances running for 15 to 30 minutes while bringing up demand systems and archiving data.
  
  Web based application can use Elastic Load Balancer to help in addressing termination automatically. A smart implementor would put in place a set of scripts to handle the alert. They could maintain 2 low cost on demand instances which are load balanced - and then use up to half a dozen medium cost systems via spot instances to maintain high performance and spend less then a single on demand system of the same capacity.
  
  Leave 3 of them paying up to $100/hour and 3 of them paying only up to half the on demand price. As AWS terminates instances, ELB will adjust automatically. Giving the automated system up to an hour to adjust for a mere $200.
  
  
  ---
  
  