Skip to content

Instantly share code, notes, and snippets.

@murikadan
Created May 16, 2016 08:56
Show Gist options
  • Save murikadan/8f32cd4f3934cf6a513e87fa463036e9 to your computer and use it in GitHub Desktop.
Save murikadan/8f32cd4f3934cf6a513e87fa463036e9 to your computer and use it in GitHub Desktop.
import boto.route53, boto.sqs, boto.ec2
import uuid
volume_filter = {
'tag:active': 'True',
'volume-type': 'gp2',
'tag:role': 'indexer'
}
ec2 = boto.ec2.connect_to_region('eu-west-1')
volumes = ec2.get_all_volumes(filters=volume_filter)
print ('Volumes: %s' % volumes)
for volume in volumes:
group_id = str(uuid.uuid4())
new_tags = {
'archive_type' : 'WARM',
'group_id' : group_id
}
print ('Volume %s, Tags %s' % (volume.id, new_tags))
ec2.create_tags([volume.id], new_tags)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment