Migrate EC2 Instance To Another VPC , Subnet , Availability Zone

In the previous articles , I have explained How you can

migrate EC2 Instance from One AWS region to another

migrate EC2 Instance from One AWS account to another

In this guide , We will learn How can we migrate EC2 instances to another Subnet , Availability zone or VPC.

Process Involved

  • Create an AMI from existing EC2 instance
  • Launch Instance from the AMI – During this process we will be changing the VPC, subnet or AZ


Step 1:

First we need to create an AMI from the existing EC2 instance. To do so,

Login to EC2 Console , In the Left navigation pane , Choose Instances

Select the instance for which you want to create an AMI.

Refer this article to Create an AMI.

Step 2:

Once the AMI is created , Lets create a new EC2 instance from that AMI ,

You can refer this article , how to Create EC2 instance from AMI

While creating an Instance , You can modify the Instance type.

Configure Instance Details , This is the place where can change the VPC , Subnet / AZ.

For Network , Choose the VPC and For Subnet , Choose the subnet where you want to launch the instance.

You can attach an existing IAM role with this EC2 instance , Also you can Enable termination protection , To protect the production instance from accidental termination.

You can add an additional storage to the EC2 instance.

Add a tags to the new instance , and then attach an security group with the instance ,

Click Review and Launch , Review all the configurations and then click Launch.

Once the instance is launched , Choose the instance ID , Will take you to the EC2 Instances Console.

Now that we have successfully migrated the EC2 instance from One VPC , subnet to another.

Important Note

  • The New EC2 instance will be different IPv4 address , So you must update all the places that was using Old IP address with the new IP address.
  • If you have used Elastic IP address , Remove it from Old instance and attach it with the new instance.


We have learnt How we can migrate the EC2 instance from a VPC and Subnet to another.

Hope you find it helpful. Thanks for reading this article.

Check out my other publications.