Last active
March 1, 2017 18:39
-
-
Save sayanchowdhury/ffbc1f847ba84d47a454e4fd3cc603fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto.ec2 | |
import os | |
env = os.environ | |
aws_access_key_id = os.environ.get('AWS_ACCESS_KEY') | |
aws_secret_access_key = os.environ.get('AWS_SECRET_ACCESS_KEY') | |
REGIONS = ( | |
'us-east-1', | |
'us-west-2', | |
'us-west-1', | |
'eu-west-1', | |
'eu-central-1', | |
'ap-south-1', | |
'ap-southeast-1', | |
'ap-northeast-1', | |
'ap-northeast-2', | |
'ap-southeast-2', | |
'sa-east-1', | |
) | |
failed = set() | |
for region in REGIONS: | |
conn = boto.ec2.connect_to_region( | |
region, | |
aws_access_key_id=aws_access_key_id, | |
aws_secret_access_key=aws_secret_access_key) | |
snapshots = conn.get_all_snapshots(owner='self') | |
for snapshot in snapshots: | |
snap_id = snapshot.id | |
conn.modify_snapshot_attribute( | |
snap_id, | |
operation="add", attribute='createVolumePermission', | |
groups=["all"] | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is this used for?