Find interrupted Spot Instances - Amazon Elastic Compute Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Find interrupted Spot Instances

In the console, the Instances pane displays all instances, including Spot Instances. The instance lifecycle of a Spot Instance is spot. The instance state of a Spot Instance is either stopped or terminated, depending on the interruption behavior that you configured. For a hibernated Spot Instance, the instance state is stopped.

To find an interrupted Spot Instance using the console
  1. Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/.

  2. In the navigation pane, choose Instances.

  3. Apply the following filter: Instance lifecycle=spot.

  4. Apply the Instance state=stopped or Instance state=terminated filter depending on the interruption behavior that you configured.

  5. For each Spot Instance, on the Details tab, under Instance details, find State transition message. The following codes indicate that the Spot Instance was interrupted.

    • Server.SpotInstanceShutdown

    • Server.SpotInstanceTermination

  6. For additional details about the reason for the interruption, check the Spot request status code. For more information, see Spot request status.

To find interrupted Spot Instances using the Amazon CLI

You can list your interrupted Spot Instances using the describe-instances command with the --filters parameter. To list only the instance IDs in the output, include the --query parameter.

If the instance interruption behavior is to terminate the Spot Instances, use the following command:

aws ec2 describe-instances \ --filters Name=instance-lifecycle,Values=spot Name=instance-state-name,Values=terminated Name=state-reason-code,Values=Server.SpotInstanceTermination \ --query "Reservations[*].Instances[*].InstanceId"

If the instance interruption behavior is to stop the Spot Instances, use the following command:

aws ec2 describe-instances \ --filters Name=instance-lifecycle,Values=spot Name=instance-state-name,Values=stopped Name=state-reason-code,Values=Server.SpotInstanceShutdown \ --query "Reservations[*].Instances[*].InstanceId"