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

Last updated: 2019-06-12

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

Short Description

To move an EC2 instance:

  1. Create a new Amazon Machine Image (AMI) from the source instance.
  2. Use the AMI to launch a new instance.
  3. Reassign the Elastic IP address from the instance you are moving to the new image.


Before you begin, note the following:

  • AMIs are based on Amazon Elastic Block Store (Amazon EBS) snapshots. For large file systems without a previous snapshot, creating an AMI can take several hours. To decrease the AMI creation time, first create an Amazon EBS snapshot before creating the AMI.
  • Creating an AMI doesn't create a snapshot for instance store volumes on the instance. For information on backing up instance store volumes to Amazon EBS, see How do I back up an instance store volume on my Amazon EC2 instance to Amazon EBS?
  • The new EC2 instance will have a different private IPv4 or public IPv6 IP address. You must update all references to the old IP addresses (for example, in DNS entries) with the new IP addresses that are assigned to the new instance. If you're using an Elastic IP address on your old instance, be sure to attach it to the new instance.

Create a new image

  1. From the EC2 console, choose Instances from the left navigation pane.
  2. Choose the instance that you want to move, choose Actions, choose Instance State, and then choose Stop. This assures that the data is consistent between the old and new EBS volumes.
    Note: You can skip this step if you're testing this procedure or if you don't want to stop or reboot your instance.
  3. Choose Actions, Image, and then Create Image.
    Note: If you select No reboot, the file system integrity of the image can't be guaranteed.
  4. Choose View pending image ID. Wait for the Status to change from pending to available.

Launch a new instance

  1. Choose the new AMI, and then choose Launch Instance.
  2. Choose the same instance type as the instance you want to move, and choose Next: Configure Instance Details.
  3. For Network, choose your VPC, and for Subnet, choose the subnet where you want to launch the new instance.
  4. If the instance is a production instance, choose Protect against accidental termination, and then choose Next: Add Storage.
  5. Accept the defaults, and then choose Next: Add Tags.
  6. For Key, enter Name, and for Value, enter your instance name.
  7. Choose Next: Configure Security Group.
  8. Choose the same security group that's applied to the instance that you're moving. Choose Review and Launch.
    Note: If you're moving your instance between VPCs, you must create a new security group on the destination VPC.
  9. Choose Launch.
  10. In Select a key pair, choose your key pair from the drop-down menu, select the agreement check box, and then choose Launch Instances.
  11. Choose the instance ID to return to the EC2 console.

Reassign the Elastic IP address

Follow the steps at Disassociating an Elastic IP Address and Reassociating with a Different Instance.

Note: Elastic IP addresses can be used in only one Region. If you move an instance to a different Region, you can't use the same Elastic IP address.