Copy AMI between regions

Finally this feature is available and easy as the click of a button. While it was previously almost impossible and last year through snapshots only you can select any AMI and copy to another region. It makes my life much easier and I stop maintaining reference images for every region but can make use of one image only ! More info here.

AMI Transferral

AMI Transferral

Copying AMIs

You can easily copy the Amazon Machine Images (AMIs) that you own to other AWS regions and scale your applications to take advantage of AWS’s geographically diverse regions.

Copying your AMIs provides the following benefits:

  • Consistent global deployment: You can copy an AMI from one region to another, enabling you to launch consistent instances based from the same AMI into different regions.
  • Scalability: You can more easily design and build world-scale applications that meet the needs of your users, regardless of their location.
  • Performance: You can increase performance by distributing your application, as well as locating critical components of your application in closer proximity to your users. You can also take advantage of region-specific features, such as instance types or other AWS services.
  • High availability: You can design and deploy applications across AWS regions, to increase availability.

AMI Copy

You can copy an AMI to as many regions as you like, using the AWS Management Console, the Amazon EC2 CLI, or the Amazon EC2 API. You can copy an AMI to the same region. You can copy both Amazon EBS-backed AMIs and instance-store-backed AMIs.

There are no charges for copying an AMI. However, standard storage and data transfer rates apply.

Each copy of an AMI results in a new AMI with its own unique AMI ID. The new AMI is fully independent of the source AMI; there is no link to the original (source) AMI. You can modify the new AMI without affecting the source AMI. The reverse is also true: you can modify the source AMI without affecting the new AMI. Therefore, if you make changes to the source AMI and want those changes to be reflected in the AMI in the destination region, you must recopy the source AMI to the destination region.

We don’t copy launch permissions, user-defined tags, or Amazon S3 bucket permissions from the source AMI to the new AMI. After the copy operation is complete, you can apply launch permissions, user-defined tags, and Amazon S3 bucket permissions to the new AMI.

We try to find matching AKIs and ARIs for the new AMI in the destination region. If we can’t find a matching AKI or ARI, then we don’t copy the AMI. If you are using the AKIs and ARIs that we recommend, the copy operation registers the AMI with the appropriate AKI and ARI in the destination region. If you get an error message “Failed to find matching AKI/ARI”, it means that the destination region doesn’t contain an AKI or ARI that matches those specified in the source AMI. If your AMI uses a PV-GRUB AKI, then you can update the AMI to leverage the latest version of PV-GRUB. For more information on PV-GRUB and AKIs, see Using Your Own Linux Kernels.

Copying an Amazon EC2 AMI

Prior to copying an AMI, you must ensure that the contents of the source AMI are updated to support running in a different region. For example, you should update any database connection strings or similar application configuration data to point to the appropriate resources. Otherwise, instances launched from the new AMI in the destination region may still use the resources from the source region, which can impact performance and cost.

AWS Management Console

To copy an AMI using the console

  1. Open the Amazon EC2 console.
  2. From the navigation bar, select the region that contains the AMI to copy.
  3. In the navigation pane, click AMIs.
  4. Select the AMI to copy, click Actions, and then click Copy AMI.
  5. In the AMI Copy page, set the following fields, and then click Copy AMI:
    • Destination region: Select the region to which you want to copy the AMI.
    • Name: Specify a name for the new AMI.
    • Description: By default, the description includes information about the source AMI so that you can identify a copy from the original. You can change this description as necessary.
  6. We display a confirmation page to let you know that the copy operation has been initiated and provide you with the ID of the new AMI.To check on the progress of the copy operation immediately, click the provided link to switch to the destination region. To check on the progress later, clickDone, and then when you are ready, use the navigation pane to switch to the destination region.

    The initial status of the destination AMI is pending and the operation is complete when the status is available.

Command Line Interface

To copy an AMI using the CLI

You can copy an AMI using the ec2-copy-image command. This command initiates the copy operation and registers the new AMI in the destination region.

This command is submitted to and initiated from the destination region endpoint.

API

To copy an AMI using the API

You can copy an AMI using CopyImage.

This call is submitted to and initiated from the destination region endpoint.

Stopping a Pending AMI Copy Operation

AWS Management Console

To stop an AMI copy operation using the console

  1. Open the Amazon EC2 console.
  2. From the navigation bar, select the destination region from the region selector.
  3. In the navigation pane, click AMIs.
  4. Select the AMI you want to stop copying, click Actions, and then click Deregister.
  5. When asked for confirmation, click Continue.

Command Line Interface

To stop the AMI copy operation using the CLI

You can stop an AMI copy operation using the ec2-deregister command.

This command stops the copy operation and deregisters the new AMI in the destination region.

API

To stop the AMI copy operation using the API

You can stop an AMI copy operation using DeregisterImage.

This action stops the copy operation and deregisters the new AMI in the destination region.

Advertisements
Leave a comment

Leave your opinion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: