AWS Resource Migration across account – Part 1 – EC2

There have been cases when one need to migrate there AWS account. The one very obvious reason is that you’re using AWS free tier services. And after an year, as the free tier is over, you may want to create a new AWS account.

But when you create a new AWS account, you need to recreate all of your AWS resources, like EC2, ELB, S3, RDS, Elasticsearch, etc.

Along with recreating all the resources you would need to retain all the data, tools, settings of your current AWS resources. For example, suppose you were running an EC2 machine for a website. You had installed various tools on that machine, like phpmyadmin, nodejs, nginx, python, gunicorn.

Now creating a new account and corresponding resources is Okay, but re-setting everything to current state is not very straight-forward.

But let me tell you, the resetting of everything is not actually very difficult.

This article of the AWS account migration series will focus on migration of EC2 resource on AWS.

Terminologies:

  • naws : New AWS account
  • oaws: Old AWS account

Steps to migrate EC2 from oaws to naws:

  1. Create an AMI for EC2 resource in oaws
  2. Edit Permission of above created AMI.
  3. Add naws account id in the step 2. This should share the above AMI with naws.
  4. Wait for few minutes. The sharing of AMI might take 5-15 minutes.
  5. Go to AMI list and select Shared AMIs. You should see above create AMI here. In case you don’t see it yet, pl wait for a while.
  6. Once you see the new AMI in naws, select that AMI and launch a new EC2 resource.
  7. Create New security group in naws, copying values from oaws.
  8. Attach above created security group to the new EC2 resource in naws.
  9. You should have a working EC2, a clone of EC2 in oaws. You might have to ssh into new EC2 resource and start your servers, in case they are not included in upstart script as the EC2 is recently launched and hence started.

Leave a Reply