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
- Open the Amazon EC2 console and choose Spot Requests from the left navigation pane.
- Choose Request Spot Instances, choose an Availability Zone, and then choose Next.
- 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.