Find interrupted Spot Instances - Amazon Elastic Compute Cloud

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.aws.amazon.com/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 Get the status of a Spot Instance request.

To find interrupted Spot Instances using the AWS 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"