I have created an EC2 Instance with "Delete on Termination" set to False at EBS Root storage. Now, I want to set it to True using AWS CLI.
Asked
Active
Viewed 248 times
1 Answers
2
To enable delete on termination for EBS:
aws ec2 modify-instance-attribute \
--instance-id <...> \
--block-device-mappings "[{\"DeviceName\": \"/dev/sdf\",\"Ebs\":{\"DeleteOnTermination\":true}}]"
To enable delete on termination for an instance:
aws ec2 modify-instance-attribute \
--instance-id <...> \
--instance-initiated-shutdown-behavior terminate

Yann
- 2,426
- 1
- 16
- 33