Copy AMI Images across regions

Copying AWS Amazon Machine Images Across Regions with unSkript

When you are building a distributed platform, You’ll need to regularly update the machines that you have deployed around the world.  With Amazon Web Services (AWS), one way to do this is to deploy the updated machine in one region, and create an Amazon Machine Image (AMI) of that server.  Then, by copying that AMI to different AWS regions, you can easily deploy an identical server anywhere around the world.

Copying AMIs across regions is possible to do via the AWS console UI, or using the AWS command line.  At unSkript, we are working to remove the manual toil of running scripts against the command line, or performing multi-step manual processes in the UI.  With hundreds of pre-built connectors and Actions to perform common tasks with the most popular cloud services – it is easy to get started with unSkript in just minutes.  Try it today – either with our Open Source Docker image that you can run on-premises, or with a free trial of our Cloud offering.

Copying AMIs across regions

In your install of unSkript, there will be a RunBook called “Copy AMI to All Given AWS Regions.”  This RunBook is pre-configured to perform the AMI copy with just the click of a button.  When you open this RunBook (or import your copy into your work area), you’ll only have a few steps before you can begin copying your AMIs.

At the top of the page, there is a Parameters drop down, where the input parameters for the RunBook are entered:

A Screenshot of RunBook input parameters

In the screenshot above, we have an ami_id (with pixelated name) with a source_region of us-west-2.  We are looking to copy this AMI to the destination_regions us-east1 and us-east-2.  These can be edited with the Edit Value button. When you run this RunBook via the UI – you will be give the opportunity to insert different values.

Configuring the Actions

Each step of the RunBook is completed by an Action.  We will need to quickly configure each Action with credentials that allow unSkript to connect to AWS.  If you do not yet have AWS Credentials in unSkript, follow the link to set up your credentials.  To Configure your action, click the Configurations button.  On the right side, select the AWS credential you’d like the RunBook to connect with:

AWS credential
Connecting with the DevRole credential

Repeat this for all AWS Actions in the RunBook:

  • Get all AWS Regions
  • Get AMI Name
  • Copy AMI to Other Regions

Once the credentials are set up, save your RunBook.  It can now be run from this page in two ways: Run XRunBook button: or interactively – running one Action at a time. But it can now also be run via the RunBook listing page, or using our API.

Here is the interactive output of the final Action, where the AMI image was copied into us-east-1 and us-east-2.

screenshot of the completion of the runbook - 2 AMIs are copied into new regions

Summary

In this post, we utilized unSkript to automate the copying of AMI’s across AWS regions.  Rather than build a RunBook ourselves, we were able to utilize a pre-built RunBook, and simply configure the RuBook for our use case.  With just a few steps, we were able to authenticate this RunBook to run in our AWS instance, and copy AMI images from one region to many other regions.  By automating such repetitive tasks, unSkript alleviates DevOps toil of repetitive tasks, allowing the team to focus on more important projects.

Give us a try today, and if you like what you see, give us a star on GitHub! Questions?  Join our Slack Community – we’d be happy to help.

Share your thoughts