Interruption behavior - Amazon Elastic Compute Cloud

Interruption behavior

You can specify that Amazon EC2 must do one of the following when it interrupts a Spot Instance:

Specify the interruption behavior

You can specify the interruption behavior when you create a Spot request. If you do not specify an interruption behavior, the default is that Amazon EC2 terminates Spot Instances when they are interrupted.

The way in which you specify the interruption behavior is different depending on how you request Spot Instances.

  • If you request Spot Instances using the launch instance wizard, you can specify the interruption behavior as follows: In the launch instance wizard, expand Advanced details and select the Request Spot Instances check box. Choose Customize. From Interruption behavior, choose an interruption behavior. If the interruption behavior is hibernation, you can alternatively choose Enable for Stop - Hibernate behavior.

  • If you request Spot Instances using the run-instances CLI, you can specify the interruption behavior as follows: In the request configuration, (--instance-market-options), for InstanceInterruptionBehavior, specify an interruption behavior. If the interruption behavior is hibernate, you can alternatively enable hibernation using the --hibernation-options Configured=true parameter.

  • If you configure Spot Instances in a launch template, you can specify the interruption behavior as follows: In the launch template, expand Advanced details and select the Request Spot Instances check box. Choose Customize and then, from Interruption behavior, choose an interruption behavior.

  • If you request Spot Instances using the Spot console, you can specify the interruption behavior as follows: Select the Maintain target capacity check box and then, from Interruption behavior, choose an interruption behavior.

  • If you configure Spot Instances in the request configuration when using the create-fleet CLI, you can specify the interruption behavior as follows: For InstanceInterruptionBehavior, specify an interruption behavior.

  • If you configure Spot Instances in the request configuration when using the request-spot-fleet CLI, you can specify the interruption behavior as follows: For InstanceInterruptionBehavior, specify an interruption behavior.

  • If you configure Spot Instances using the request-spot-instances CLI, you can specify the interruption behavior as follows: For --instance-interruption-behavior, specify an interruption behavior.

Note

We strongly discourage using the request-spot-fleet and request-spot-instances commands to request Spot Instances because they are legacy APIs with no planned investment. For more information, see Which is the best Spot request method to use?