Why did Amazon EC2 terminate my Spot Instance?

Last updated: 2021-09-17

I launched a Spot Instance but now I can't find it in the Amazon Elastic Compute Cloud (Amazon EC2) console. Why did Amazon EC2 terminate my Spot Instance?

Resolution

Amazon EC2 can interrupt your Spot Instance at any time with a two-minute notice for the following reasons:

  • Lack of Spot capacity: Amazon EC2 can interrupt your Spot Instance when its capacity is required. Most often, Amazon EC2 reclaims your instance to repurpose capacity. Amazon EC2 might also terminate your Spot Instance for issues such as host maintenance or hardware decommission.
  • Amazon EC2 can't meet your Spot Instance request constraints: If your Spot request includes a constraint, such as a launch group or a specific Availability Zone group, the Spot Instances are terminated as a group when the constraint can no longer be met.
  • The Spot Price is higher than the maximum price you set: When you request a Spot Instance, you have the option to specify a maximum price for the instance. By default, this maximum price is equal to the On-Demand pricing for that instance type. When the Spot Price increases beyond your set maximum price, your Spot Instance is interrupted. If you set the interruption behavior to "stop" or "hibernate", your Spot Instance starts again when the Spot price reduces to under your maximum price. Setting a high maximum price doesn't mean that a Spot Instance is available. For more information, see How Spot Instances work.

Because of these interruptions, it's a best practice to use Spot Instances for workloads that are stateless, fault-tolerant, and flexible enough to withstand interruptions.

Note: When Amazon EC2 interrupts a Spot Instance, the Spot Instance is terminated by default. You can change this default behavior to hibernate, or you can stop the instance instead of terminating it. For more information, see Interruption behaviors.

To determine why Amazon EC2 interrupted your Spot Instance, do the following:

  1. Open the Amazon EC2 console, and then select Spot Requests.
  2. Select the Request ID of the terminated Spot Instance.
  3. View the Status field under the Description section to see the reason code for why the instance was terminated. For example, If Amazon EC2 didn’t have enough Spot Capacity, the Status field says "instance-terminated-no-capacity". For a complete list of reason codes, see Spot request status codes.

You can use Spot Instance interruption notices to work around potential interruptions. For more information, see Taking advantage of Amazon EC2 Spot Instance interruption notices.