Why is my Spot Instance terminating even though the maximum price is higher than the Spot price?
Last updated: 2021-09-21
Amazon Elastic Compute Cloud (Amazon EC2) is terminating my Spot Instance even though the maximum price I set is higher than the Spot Price. How can I troubleshoot this?
Amazon EC2 might terminate your Spot Instance even if your maximum price is higher than the Spot price for the following reasons:
- Lack of Spot Capacity - Amazon EC2 interrupts your Spot Instance when the capacity is needed. Often Amazon EC2 reclaims your instance to repurpose capacity. Your Spot Instance might also be terminated for issues such as host maintenance or hardware decommission.
- Amazon EC2 can't meet your Spot Instance request constraints - If your request includes a constraint such as a launch group or a specific Availability Zone group, then the Spot Instances are terminated as a group when the constraint can no longer be met.
Setting a high maximum price doesn't guarantee Spot Instance availability. For more information, see How Spot Instances work.
Note: When Amazon EC2 interrupts a Spot Instance, by default the Spot Instance is terminated. You can change this default behavior to hibernate or 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:
- Open the Amazon EC2 console, and then select Spot Requests.
- Choose the Request ID of the terminated Spot Instance.
- View the Status field under the Description section to see reason code explaining 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.