Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boto - copy snapshot to another region

Any ideas on how to easily copy a snapshot to another region with boto?

You can easily do it through the management console - right clicking the snapshot, then "copy", then choosing your preferable region.

I hoped to have something similar with boto but couldn't find any.

Thanks

like image 404
nivniv Avatar asked Jan 12 '23 16:01

nivniv


1 Answers

You can use the copy_snapshot() method in the EC2 module to copy snapshots within a region or between regions. For example, if you had an existing snapshot in us-east-1 and you wanted to copy it to us-west-2 you could do this:

import boto.ec2

conn = boto.ec2.connect_to_region('us-west-2')
conn.copy_snapshot(source_region='us-east-1', source_snap_id='snap-12345678',
                   description='My new copy')

see: boto.ec2.connection.EC2Connection.copy_snapshot

like image 144
garnaat Avatar answered Jan 18 '23 23:01

garnaat