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
-
Open the Amazon EC2 console at https://console.amazonaws.cn/ec2/
. -
In the navigation pane, choose Instances.
-
Apply the following filter: Instance lifecycle=spot.
-
Apply the Instance state=stopped or Instance state=terminated filter depending on the interruption behavior that you configured.
-
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
-
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"