Copying AWS Amazon Machine Images Across Regions with unSkript
Tags: otherposts
Published: 2023-04-19 20:18:26

---
title: Copying AWS Amazon Machine Images Across Regions with unSkript
published: true
date: 2023-01-24 20:29:29 UTC
tags: OtherPosts
canonical_url: https://unskript.com/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](https://github.com/unskript/Awesome-CloudOps-Automation) that you can run on-premises, or with a[free trial of our Cloud](https://us.app.unskript.io/) offering.

# Copying AMIs across regions

In your install of unSkript, there will be a RunBook called “[_Copy AMI to All Given AWS Regions._](https://github.com/unskript/Awesome-CloudOps-Automation/blob/master/AWS/Copy_ami_to_all_given_AWS_regions.ipynb)”  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](https://i0.wp.com/unskript.com/wp-content/uploads/2023/01/parameters_moveami.jpg?resize=945%2C464&ssl=1)

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](https://docs.unskript.com/unskript-product-documentation/guides/connectors/aws#authentication) 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](https://i0.wp.com/unskript.com/wp-content/uploads/2023/01/Screenshot-2023-01-24-at-14.59.07.jpg?resize=902%2C414&ssl=1)
_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](https://i0.wp.com/unskript.com/wp-content/uploads/2023/01/copycompleted.jpg?resize=945%2C230&ssl=1)

# 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](https://us.app.unskript.io/xRunBooks), and if you like what you see, give us a [star on GitHub](https://github.com/unskript/Awesome-CloudOps-Automation)! Questions?  Join our [Slack Community](https://communityinviter.com/apps/cloud-ops-community/awesome-cloud-automation) – we’d be happy to help.