How to Migrate an EC2 Instance from One Region to Another

How to Migrate an EC2 Instance from One Region to Another

How to Migrate an EC2 Instance from One Region to Another

You can create an EC2 instance in any region of your choice. However, when you have an instance customized as per your need with software and application, and you want to move it to some other region, at the time of writing this, there is no one-click option to just move it to another region by choosing the other region.

But obviously, it’s not a difficult take either. let’s see how can we do it.

Don’t want to miss any posts from us? join us on our Facebook group, and follow us on Facebook, Twitter, LinkedIn, and Instagram. You can also subscribe to our newsletter below to not miss any updates from us.

Prerequisite:

We need an up-and-running EC2 instance which is customized for our needs. I already have one running in ap-south-1(Mumbai). In this post, I will move this instance to ap-southeast-2(Sydney).

As of now if you hit the public IP of my instance in Mumbai, you will see a website running there greeting you with the below message

How to Migrate an EC2 Instance from One Region to Another 1

I expect the same to happen when my instance is moved to another region. Alright, we are clear on the motive.

Let’s start.

Steps to Migrate an EC2 Instance from One Region to Another

  1. Create a Custom Image of the Existing Instance
  2. Copy Created Image to the Destination Region
  3. Launch Your Instance in Destination Region using AMI

Step 1: Create a Custom Image of the Existing Instance

Select the EC2 instance that you want to move to another region and click on the Actions dropdown.

Actions ->Image and templates -> Create image

How to Migrate an EC2 Instance from One Region to Another 2

Click on Image and Templates and click on Create Image, you are taken to create image screen that looks like below-

How to Migrate an EC2 Instance from One Region to Another 3

Provide an Image name and Image description. You can also click the No reboot enable as shown the screenshot if your instance is running and you don’t want it to reboot while the image is being prepared.

Leave the other details as default and click on Create image

How to Migrate an EC2 Instance from One Region to Another 4

Once you click Create Image,

How to Migrate an EC2 Instance from One Region to Another 5

You get the success message. However, as you can see don’t delete the instance until your migration is complete.

Step 2: Copy Created Image to the Destination Region

Click on the Image Id shown in above success message or you can directly go to the AMI section from the left menu side.

Select your AMI -> Actions -> Copy AMI

Click on the Actions dropdown and click Copy AMI

How to Migrate an EC2 Instance from One Region to Another 6

Once you click on copy image, the below screen appears.

How to Migrate an EC2 Instance from One Region to Another 7

Choose the destination region in which you want to migrate your EC2 instance in our case Sydney.

Now click on Copy AMI

How to Migrate an EC2 Instance from One Region to Another 8

AMI copy operation is initiated and you see a success message like above.

Further, you can track the status of the AMI in the destination region ie. ap-southeast-2.

Step 3: Launch Your Instance in Destination Region using AMI

Change your region to the destination region which is sydney in our case. After than open Ec2 and click on AMI from left nav menu.

Selct the copied A<Mi and click on Launch instance from AMI as shown below-

How to Migrate an EC2 Instance from One Region to Another 9

Provide a name for your new instance, you can also keep it same as old one. Select the keypair. Ylu can decide to

  1. You can create a new key pair or decide to use existing one
  2. Review security group and add HTTP rule so as to allow the internet access as our is a web server

I wanted to keep the same key pair so I clicked on key pair -> action and imported my existing key pair from Mumbai region.

Review once and click on Launch an instance

After that instance is launched, I just grabbed the public IP and hit it. We are at the same place where we started. So this migration was successful.

How to Migrate an EC2 Instance from One Region to Another 10

Conclusion

We learnt how to migrate an EC2 instance from one region to another. Basically, we had an up-and-running instance that was configured to our needs. Then we created an AMI from the existing instance. We copied the AMI to the destination region and created an instance from the copied AMI in that region.

Were you able to migrate your Ec2 instance from one region to another using this tutorial? Let me know in the comment section.

Enjoyed the content?

Subscribe to our newsletter below to get awesome AWS learning materials delivered straight to your inbox.

Don’t forget to motivate us-

Suggested Read:

Leave a Reply

Your email address will not be published. Required fields are marked *