Member preview

Copy AWS EC2 Instances from one account to another

Overview

Recently one of our customers came up with a requirement to merge assets into one single AWS account, there are some other ways such AWS Organization to manage multiple AWS accounts but in this case, the requirement was clear to move EC2 instances from one account to another.

The solution to this requirement was quick straightforward and convenient from AWS. To summarize you need to do the following

  1. Obtain AWS account ID where you want to copy/move/migrate the EC2 instance (We will call it Target account)
  2. On source AWS account, create AMI from existing EC2 instance
  3. Grant access permissions on AMI to target AWS account
  4. Log in to target AWS account and launch a new EC2 instance from AMI

Obtaining Target AWS Account ID

To obtain AWS account ID a simple solution is to do the following

  1. Log in to AWS console on the target account
  2. Click on the top right corner Support > Support Center
  3. Copy the AWS Account ID and paste it to your favorite notepad, we will need it later

Create AMI of existing EC2 Instance

  1. Log in to source AWS account using AWS console
  2. Click Services > Compute > EC2 or Search EC2
  3. Click Running Instances on EC2 Dashboard
  4. Right-click your instance choose Image > Create Image
  5. Enter required info on the dialogue and click “Create Image”

Grant Permissions on AMI to target AWS account

  1. Click on the AMI on the left panel under Images
  2. Select your newly created AMI
  3. Click Actions > Modify Image Permissions
  4. Enter AWS account number for target account and click Add Permission
  5. Click Save

Launch EC2 Instance in Target Account

  1. Log in to target account’s AWS console
  2. Go to EC2 Instance dashboard
  3. Click Launch Instance
  4. Under My AMIs sections on the left click “Shared with me”, you will see your recently created AMI there
  5. Select AMI and continue launching your EC2 Instance

Hope you find it useful, please leave your comments and questions and let us know what you would like us to post about

Have a great day

Cheers,

Zeeshan Baig

Follow me on Twitter @IamZeeshanBaig

About DataNext

DataNext Solutions is US based system integrator, specialized in Cloud, Big Data, DevOps technologies. As a registered AWS partner, our services comprise of any Cloud Migration, Cost optimization, Integration, Security and Managed Services. Click here and Book Free assessment call with our experts today or visit our website www.datanextsolutions.com for more info.