I'd like to create a Lambda function (python) that will copy an already created snapshot to another region, automatically.
I've reached out to AWS Support and they've only sent me GitHub scripts that were for RDS databases. No EC2 snapshot copy scripts :(
Any help would be great!
Thank you.
Yes you can do that with boto3
Example:
Copying snapshot from region us-east-1
to region eu-west-1
import boto3
def lambda_handler(event, context):
client = boto3.client('ec2')
client.copy_snapshot(SourceSnapshotId='snap-xxxxxx',
SourceRegion='us-east-1',
DestinationRegion='eu-west-1')
If the snapshot is encrypted, add PresignedUrl
parameter additionally.