Can We Move EC2 Instances Across AWS Accounts?

  • Cubettech
  • Web App Development
  • 10 years ago

In fact, we cannot access running ec2 instances from different Amazon Web Service (AWS) accounts. But we can use some methods to get exact copy of that instance on other accounts. With this post, I intent to illustrate two methods for sharing instance across two different accounts, using AMI and using EBS snapshot.

 Note: AMI is the exact image of the instance with OS. We can just create new instance with the AMI. AMI stores data as EBS snapshot. EBS snapshot is just copy of the EBS volume(like Hard Disk). We need to create AMI from that snapshot before launching the instance from it.

Method 1 : Using AMI

1) Create an image of the existing instance which is to be shared.

    Note: Creating AMI image will cause the system to reboot.

 Moving EC2 Instances Across AWS Accounts

2)  Change the image permission from the AMI menu and the account number where the instance should be shared.

 Note: You can find your account number in the IAM users sign-in link which is showed in security credentials menu.

Modifying Image Permissions

3) Go to the other account and you can see the AMI being listed  in private section of AMI menu.

Finding AMI  Listed  in Private Section of AMI Menu

4) Then right click on the image and click launch to create the exact copy of the instance.

Launching  Copy of the Instance

Method 2 : Using EBS snapshot.

One of the  advantages of snapshot method is that we can create the new machine from any state of the server from the snapshot backup.

1) Before proceeding with this step, make sure that you have created a snapshot as given below, or you can select an existing backup snapshot.

Choosing Existing Backup Snapshot

2) Change the permission of the snapshot as we have done before on the AMI

Change  Permission of Snapshot

3) Add the account number where the snapshot is to be shared.

Modifying Snapshot Permission

4) Go to  the other account, and we can find the shared snapshot in the private section.

Search for  Shared Snapshot in Private Section

5) Then we can create an AMI and launch instance from it.

Creating an AMI and Launch Instance

I hope, this post was useful enough to cater solutions to all your concerns regarding using EC2 instances across multiple AWS accounts, if you have more concerns, feel free to drop a line or two in the comment box below, I’d really appreciate it and revert with an ideal solution as soon as possible.

Know More About This Topic from our Techies

Got a similar project idea?

Connect with us & let’s start the journey!

Questions about our products and services?

We're here to support you.

Staff augmentation is a flexible workforce strategy companies adopt to meet specific project needs or address skill gaps.

Begin your journey!
Need more help?