Skip to content

How do I move my Amazon EC2 instance to another subnet, Availability Zone, or VPC?

4 minute read
4

I want to move or copy my Amazon Elastic Compute Cloud (Amazon EC2) instance to another subnet, Availability Zone, or virtual private cloud (VPC).

Short description

You can't move an existing EC2 instance to another subnet, Availability Zone, or VPC. Instead, you must create a new Amazon Machine Image (AMI) from the source instance, and then use the AMI to launch a new instance. Use the AWSSupport-CopyEC2Instance runbook to automatically create a new AMI and new instance. Or, manually launch the instance from an AMI.

Then, reassign all Elastic IP addresses from the source instance to the new instance.

Resolution

Prerequisites:

  • To decrease the AMI creation time, create an Amazon Elastic Block Store (Amazon EBS) snapshot before you create the AMI. For large file systems without an existing snapshot, AMI creation can take several hours.
  • Use Sysprep or remove the domain-joined instance from the domain to prevent conflict issues. Domain security identifier (SID) conflict issues can occur when the new instance launches and tries to contact the domain.
  • Back up your instance store volumes. When you create an AMI, you don't automatically create a snapshot for instance store volumes on the instance.

Use the AWSSupport-CopyEC2Instance runbook to create a new AMI and new instance

Note: You must run the runbook in the same AWS Region as the existing instance.

Run the AWSSupport-CopyEC2Instance runbook and configure the following Input parameters:

  • For InstanceID, enter the instance ID of the existing instance. If you use the interactive instance picker, then select Show all instances.
  • For Region, enter the destination Region.
  • For SubnetID, enter the destination subnet ID.

To monitor progress, complete the following steps:

  1. Open the AWS Systems Manager console.
  2. In the navigation pane, choose Automation.
  3. Choose the running automation, and then check Executed steps.
  4. To view the automation output, expand Outputs.

Manually launch the instance from an AMI

Complete the following steps:

  1. Create a new AMI from the instance.
  2. Open the Amazon EC2 console.
  3. In the navigation pane, choose AMIs.
  4. Set the filter to Owned by me, and then choose the new AMI.
  5. Choose Launch instance from AMI.
  6. Under Name and tags, enter a name for your new instance. You can use the existing name and tags.
  7. Under Instance type, select the same instance type as the existing instance.
  8. Under Key pair (login), for Key pair name, select the key pair that the existing instance uses.
  9. Under Network settings, configure the following settings:
    For Network, choose the VPC that you want to move to.
    For Subnet, choose the subnet where you want to launch the new instance.
    For Firewall (security groups), choose the same security group that the existing instance uses.
    Note: To recreate the instance in a new VPC, you must create a new security group in the destination VPC.
    (Optional) Configure the remaining fields based on your new instance's requirements.
  10. (Optional) To manually specify a primary private IP address, expand Advanced network configuration. For Primary IP, enter an available IP address in the selected subnet. If you don't specify a private IP address, then Amazon EC2 automatically assigns a private IP address from the available addresses in the subnet.
    Note: If you move or copy the instance to a new subnet or VPC, then you can't keep the same private IP address. Private IP addresses are tied to a subnet's CIDR block.
  11. Configure the remaining sections of the launch wizard.
  12. Under Summary, review a summary of your instance configuration, and then choose Launch instance.

When the instance launches, you receive a Success message. To check the instance status, choose the instance ID in the Success message.

Reassign the Elastic IP addresses

Note: The new instance has a different private IPv4 or public IPv6 IP address. Update all references to the previous IP addresses with the new IP address. For example, update the DNS entries.

If you use an Elastic IP address on your source instance, then you must attach the Elastic IP address to the new instance. To reassign an Elastic IP address, disassociate the Elastic IP address from the source instance. Then, associate the Elastic IP address with the new instance. You can use the Elastic IP address in only one Region. If you move an instance to a different Region, then you can't use the same Elastic IP address.

Important: After you verify that your new instance works as expected, deregister the AMI and delete the associated snapshots.

Related information

Create an Amazon EBS-backed AMI

How do I create an Amazon EC2 instance AMI in one Region and then copy it to another Region?

4 Comments

With the new multi-homed instances the secondary ENI can be in a different subnet or even VPC as long as it is in the same account and zone. Wouldn't that be a way to more simply move an EC2? See

replied 2 years ago

Thank you for your comment. We'll review and update the Knowledge Center article as needed.

AWS
MODERATOR
replied 2 years ago

You can delete the AMI and Snapshot after the new instance is running. Don't forget to clean up after you do something like this, or you'll end up paying for that snapshot for years in the future!

replied a year ago

This article was reviewed and updated on 2026-05-08.

AWS
EXPERT
replied 9 days ago