Qaisar shows you how to
preserve EBS volumes
for terminated spot instances

How can I configure my Amazon Elastic Compute Cloud (Amazon EC2) Spot Instances so that the root Amazon Elastic Block Store (Amazon EBS) volume won't be deleted when I terminate the instance?

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 page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2017-02-24

Updated: 2018-05-21