Created
April 12, 2015 17:35
-
-
Save nmagee/6c08c719953de01acb4e to your computer and use it in GitHub Desktop.
Copy AMI to new Region
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script creates a series of prompts to create an AMI of an EC2 instance from a few AWS profiles | |
# Comes with a fixed US-East-1 to US-West-2 migration path. Modify accordingly for your own needs. | |
# 09.05.2014 Neal Magee | |
set -e | |
clear | |
echo "" | |
read -p " What AWS profile does this AMI belong to? (Enter 'default' to use that profile): " profile | |
echo "" | |
aws --profile $profile ec2 describe-images --owners self --output text --query 'Images[*].{Ami:ImageId,Name:Name}' | |
echo "" | |
read -p " What is the Image ID of the server you want to copy: " imageid | |
read -p " What is the name you want to give this AMI copy? (No spaces): " aminame | |
echo "\n AWS Profile: $profile" | |
echo " Instance ID: $imageid" | |
echo " AMI Name: $aminame" | |
echo " Destination Regin: US-West-2" | |
echo "" | |
echo " The API call being made to AWS is:" | |
echo " aws --profile $profile ec2 copy-image --source-image-id $imageid --source-region us-east-1 --region us-west-2 --name $aminame" | |
aws --profile $profile ec2 copy-image --source-image-id $imageid --source-region us-east-1 --region us-west-2 --name $aminame | |
echo "Your AMI copy request has been queued. Please wait for it to complete." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment