17

I created a Amazon AWS EC2 instance under my account and made an website/ftp on it, now a new partner wants to move the instance under his company account so his company can pay the bills.

We can't change the instance IP because banks in the region are communicating with the server.

How can I move the instance to a different account without having to change anything on the configuration?

Edgar J. Rodriguez
  • 285
  • 1
  • 2
  • 13

6 Answers6

19

The short answer is: No, you cannot move an running instance from one account to another unless and ofcourse AWS Technical support has some magic available behind the curtains.

You can However, Create an AMI from this instance and share this AMI with other users/account. refer: http://aws.amazon.com/articles/530

slayedbylucifer
  • 22,878
  • 16
  • 94
  • 123
  • 3
    This won't preserve the IP, though. I don't think there is any way to transfer an elastic IP to another account (if you're not using an elastic one, you can't even be sure you'll keep it if you shut it down and restart it). If it's possible at all, you'll need Amazon support's help. Since you are going to have to make the users change the address they connect to, I strongly suggest you use a DNS name rather than an IP address, so you don't run into this problem in the future. – Charles Engelke Dec 01 '13 at 12:16
  • We do have an elastic IP address, I don't think Amazon will give me support on that, I'm not enterprise. I agree with you, the best option was a DNS name. – Edgar J. Rodriguez Dec 03 '13 at 02:57
  • @David you're referring to exactly the same answer as this one. – rustyx Apr 23 '15 at 11:39
  • @David That answer is 2 years older than this one. WTF? – Jack Aug 16 '15 at 00:28
  • @Jack I am sorry. Don't know why I wrote that, I have deleted my comment. – David Aug 17 '15 at 10:44
  • His company can pay the bills no matter who is the owner of the account. The company can receive the bill by email and in your account you can pay with the company credit card. – Lucas Tettamanti Jul 15 '16 at 15:03
7

To share or migrate EC2 instances from a source account to a target account follow these steps:

  1. Create a custom Amazon Machine Image (AMI) from the instance you want to share or migrate. 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 EC2 console or the AWS Command Line Interface (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.

    Note: The private IP address of VPC instances will be different in the new account, unless you specifically set them during launch.

Related information

Source: Transfer Amazon EC2 Instance

karel
  • 5,489
  • 46
  • 45
  • 50
3

This is not possible.

AWS Support does not have access to copy Amazon EC2 resources or manipulate any configuration options in AWS accounts. You can't separate an AWS account from an Amazon.com account or transfer resources between AWS accounts. It is possible to manually migrate Amazon EC2 resources from one account to another by completing the steps described here.

Source : https://aws.amazon.com/premiumsupport/knowledge-center/account-transfer-ec2-instance/

SuperNova
  • 25,512
  • 7
  • 93
  • 64
  • Once migrated, and the new Instance is running, can the original instance that was copied be terminated? It would seem so, but it's not actually stated anywhere, and is not a lesson I want to learn the hard way. – GDP Jul 22 '17 at 15:46
  • @tryingtolearn I knew it was one of those dumb questions that they say don't exist, but I've had a few hard lessons learning AWS, and too much work has gone into the instance to not risk some ridicule, lol. – GDP Jul 23 '17 at 13:12
  • @GDP. Please take a look at this. May be helpful. https://stackoverflow.com/questions/20352244/can-i-delete-original-ec2-instance-after-creating-an-image-out-of-it – SuperNova Jul 24 '17 at 05:41
1

I'm working with several hundreds on EC2 instances in several AWS regions and accounts. You can move an EC2 instance to another AWS account, however, you can't move the Elastic IP and it will take up 16 steps with AWS CLI, if you want to migrate Tags and clone the Security Groups. I wrote a detailed post with the whole process at https://medium.com/@gmusumeci/how-to-move-an-ec2-instance-to-another-aws-account-e5a8f04cef21.

0

there are more than 10 steps involved in doing the cloud move. I would suggest you use Infrastructure as a Configuration (terraform and CloudFormation) or Infrastructure as a real code (pulumi and CDK)

however if you want to give a go at a nice tool I found called KopiCloud. Please feel welcome to try it and leave your comments below. Is good if you need to move instances on a quick lift and shift scenario.

Andre Leon Rangel
  • 1,659
  • 1
  • 16
  • 28
0

You can re-think the design of having the banks in the region communicating to your servers via IP.
If the banks communicate using DNS names, you have much more flexibility to move your servers around.
You can also achieve improvements in high availability and resiliency by moving to DNS connections.

So a plan might be

  • Setup a DNS record for your existing server
  • Get the banks who connect to your server to connect via the DNS name
  • Setup your new server in the other account (other answers describe this)
  • Cut the banks over to your new server in the new account simply by updating the DNS record

I haven't tried load balancing across accounts, but that may be another option, which would give you HA as a bonus. By registering your current instance, and new instance in another account as targets with a load balancer and getting your clients to connect to the load balancer, you could cut over to the other account. The only part I haven't tried is registering targets in different accounts, but looks like this should be possible with an AWS Network Load Balancer

Jason S
  • 1,361
  • 20
  • 24