How can I configure my EC2 Spot Instances so that the root EBS volume won’t be deleted when I terminate the instance?

Last updated: 2018-05-21

Resolution

By default, when EC2 Spot Instances are terminated, all EBS volumes attached to that instance are deleted, because the DeleteOnTermination attribute is set to true.

To change the DeleteOnTermination attribute for a new Spot request

  1. Open the Amazon EC2 console and choose Spot Requests from the left navigation pane.
  2. Choose Request Spot Instances, choose an Availability Zone, and then choose Next.
  3. In EBS volumes, clear Delete.

After you clear the Delete box, finish creating your Spot request. Any new instances that are launched when this Spot request is fulfilled will have DeleteOnTermination set to false.

To change the DeleteOnTermination attribute for a running Spot Instance

Use the modify-instance-attribute command in the AWS Command Line Interface (CLI) to configure the root EBS volume to persist on termination.


Did this article help?


Do you need billing or technical support?