I want to transfer an Amazon Elastic Compute Cloud (Amazon EC2) instance or Amazon Machine Image (AMI) from one AWS account to another account.
Resolution
You can't transfer existing instances or AMIs between accounts. Instead, you must use an AMI from the existing instance to manually launch a replacement instance in the target account.
Note: You can use the following resolution only for instances with unencrypted Amazon Elastic Block Store (Amazon EBS) volumes.
To launch a replacement instance in the target account, complete the following steps:
- Create a custom AMI of the instance in the source account. Make sure that you include all required EBS data volumes in the AMI.
- In the operating system (OS), configure the elastic network interfaces to use the Dynamic Host Configuration Protocol (DHCP) to automatically obtain IP addresses. A static IP address configuration can cause connectivity issues. Also, you can't transfer a public IP address. If your source instance has an associated Elastic IP address, then you can transfer the Elastic IP address to the target account.
Note: The AMI doesn't keep data that's stored in instance store volumes.
- Use the Amazon EC2 console or the AWS Command Line Interface (AWS CLI) to share the AMI with the target account.
Note: If you receive errors when you run AWS CLI commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.
- From the target account, find the shared AMI.
- Launch a new instance from the shared AMI on the target account. To import a key pair from a previous account, see Create a key pair using a third-party tool and import the public key to Amazon EC2.
Note: For Amazon Virtual Private Cloud (Amazon VPC) instances, the private IP address is different in the new account unless you set an IP address during launch. If you use an Elastic IP address, then associate the IP address with the replacement instance after launch.
When you no longer need to launch instances from the AMI, deregister the AMI on the source account. For information about how to delete resources in the AMI, see EBS-backed AMIs.
Note: If you deregister an AMI that the source account shared with the other account, then you can't launch new instances from the AMI in the other account. If you must launch new instances from the AMI, then keep the AMI registered in the source account. Or, copy the AMI to the same AWS Region or a different Region in the other account to keep the original AMI.
Related information
How do I create an AMI in one AWS Region and then copy it to another?
How to share encrypted AMIs across accounts to launch encrypted EC2 instances
How do I share an Amazon Machine Image (AMI) privately with another AWS account?
Share an Amazon EBS snapshot with other AWS accounts