How do I transfer an Amazon EC2 instance to a different AWS account?

Last updated: 2019-04-26

I want to transfer an Amazon Elastic Compute Cloud (Amazon EC2) instance from one Amazon Web Services (AWS) account to another. How can I do this? 

Short Description

It isn't possible to transfer existing instances between AWS accounts. Instead, you can manually migrate an EC2 image from one AWS account to another. First, create an Amazon Machine Image (AMI) based on the original EC2 instance from the source account. Then, share the AMI with the target account, and launch a new instance based on that AMI from the target account. Finally, create your own copy of the AMI on the target account to use going forward.

Resolution

To share or migrate an EC2 image from a source account to a target account, follow these steps:
Note: The following steps apply only to instances with unencrypted Amazon Elastic Block Store (Amazon EBS) volumes.

  1. Create a custom AMI from the instance that you want to use as the source account. Be sure to include all required EBS data volumes in the AMI.
    Note: Data stored on instance store volumes isn't preserved in AMIs, and won't be on the instance store volumes of the instances that you launch from the AMI.
  2. Share the AMI with the target account using either the Amazon EC2 console or the AWS Command Line Interface (AWS CLI).
  3. From the target account, find the AMI using the EC2 console or the AWS CLI.
  4. Launch a new instance from the shared AMI on the target account. To import a key pair from a previous account, see Importing Your Own Public Key to Amazon EC2.
    Note: For Amazon Virtual Private Cloud (Amazon VPC) instances, the private IP address will be different in the new account unless specifically set during launch.
  5. Create a custom AMI from the target account instance. It's a best practice to use this copy to avoid complications after the source account deregisters the originally shared AMI.
  6. If you don't need to run any instances of this Amazon EBS-backed AMI on the source account, clean up your AMI. For information about how to terminate running instances and delete associated snapshots, see Cleaning up your Amazon EBS-backed AMI.
    Note: After you deregister an AMI, you can't use it to launch new instances. Be sure that the account that you've shared your AMI with is running the instances that they need before you deregister your AMI. You can also opt to leave the AMI registered so that you can launch new instances from it in the future.

Did this article help you?

Anything we could improve?


Need more help?