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 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.
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.
3) Go to the other account and you can see the AMI being 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.
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 .
2) Change the permission of the snapshot as we have done before on the AMI
3) Add the account number where the snapshot is to be shared.
4) Go to the other account and we can find the shared snapshot in the private section.
5) Then we can create an AMI and launch instance from it.
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 back with an ideal solution as soon as possible.