I have an EC2 instance that I'd like to take a snapshot of, to use as an AMI for future spot instances.
Because of the way I created volume for this instance, it is currently set to not delete upon termination.
I want it to delete on termination, so that I can use it for spot instances and not have residual volumes hanging around needing manual deletion.
I've combed AWS manual, stack exchange, google, etc and I can only find references to a 'delete on termination' flag, but no explanation of how to use it.
You can use AWS-CLI to do this:
The simplest way is to use
modify-instance-attribute
subcommand provided byaws ec2
command.Content of file
some.json
should be:Taking on what @akshar wrote, you can have it all in the same line, without the need for an additional json file:
where
/dev/sdf
is the mount point in your instanceTaking on what everybody else said, one line and without JSON encoding and ugly escapes:
enable delete on termination, for example http://itsecureadmin.com/2011/06/aws-instance-ebs-volume-delete-on-termination/