Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable 'delete volume on termination' #2

Open
mikery opened this issue Oct 10, 2012 · 1 comment
Open

Enable 'delete volume on termination' #2

mikery opened this issue Oct 10, 2012 · 1 comment
Assignees

Comments

@mikery
Copy link
Collaborator

mikery commented Oct 10, 2012

http://boto.cloudhackers.com/en/latest/ref/ec2.html#boto.ec2.connection.EC2Connection.modify_instance_attribute

Should be an optional setting in the volumes dict, delete_on_termination, True by default.

@ghost ghost assigned mikery Oct 10, 2012
@tschellenbach
Copy link
Owner

Some info on this:
boto/boto#542
boto/boto#1023
boto/boto#820
http://itsecureadmin.com/2011/06/aws-instance-ebs-volume-delete-on-termination/

Something like this might work:

# get the current mapping
mapping = ec2,get_instance_attribute('i-xxxxxxxx', 'BlockDeviceMapping')
# remove the current value
new_mapping = set(mapping) - set('/dev/sda=false', '/dev/sda=true')
# add the new value
new_mapping = list(new_mapping) + ['/dev/sda=true']
# write the new mapping
ec2.modify_instance_attribute('i-xxxxxxxx', 'BlockDeviceMapping', ['/dev/sda=false', '/dev/sdb=true']

Not sure though, doesn't seem very forward compatible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants