Search code examples
amazon-web-servicesamazon-ec2boto3amazon-ami

Copy AMI to another region using boto3


I'm trying to automate "Copy AMI" functionality I have on my AWS EC2 console, can anyone point me to some Python code that does this through boto3?


Solution

  • From EC2 — Boto 3 documentation:

    response = client.copy_image(
        ClientToken='string',
        Description='string',
        Encrypted=True|False,
        KmsKeyId='string',
        Name='string',
        SourceImageId='string',
        SourceRegion='string',
        DryRun=True|False
    )
    

    Make sure you send the request to the destination region, passing in a reference to the SourceRegion.