View “Delete On Termination” Setting on AWS EBS Volume
- Use EC2 management console
- Click on Instances and select the instance
- Under Description tab,scroll down to “Block devices"
- Click on the device name to show the “Delete on termination” setting on the pop-up window
- Use AWS CLI
- Get the instance ID
- $ aws ec2 describe-instances --query 'Reservations[*].Instances[*].InstanceId' --output text
- Query the setting
- aws ec2 describe-instances --filter "Name=instance-id,Values=i-0d0a326ab6691cf24" --query 'Reservations[*].Instances[*].BlockDeviceMappings[*].Ebs.DeleteOnTermination'
- Get the instance ID
Modify “Delete On Termination” Setting on AWS EBS Volume
The json file format is below. Update the DeviceName to match the EBS volume that you wan to modify
[
{
"DeviceName": "/dev/xvda",
"Ebs": {
"DeleteOnTermination": false
}
}
]