Walter shows you how to
move an EC2 instance to
another subnet, AZ, or VPC


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

To move an EC2 instance, create a new Amazon Machine Image (AMI) in the desired target Availability Zone, launch a new instance based on this image, and then reassign the Elastic IP address from the instance you are moving to the new image.

Note the following:

  • This procedure is the same for copying or moving an instance between subnets, even if they are in the same Availability Zone.
  • When a new EC2 instance is launched on a different subnet, Availability Zone, or Region, then the private IPv4 or public IPv6 will change.
  • Be sure to update any DNS entry that points to the previous private/public IPv4 or IPv6 to the new IPs that are assigned to the new EC2 instance.

The AMI is based on an Amazon Elastic Block Store (Amazon EBS) snapshot. For large file systems without a previous snapshot, the AMI creation can take several hours. To decrease the AMI creation time, create an Amazon EBS snapshot before creating the AMI.

Note: If your instance has instance store volumes, the AMI creation does not create a snapshot for these volumes, and you must copy the data to a new EBS volume, or to an external location such as Amazon Simple Storage Service (Amazon S3). For more information, see How do I back up an instance store volume to EBS on my EC2 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.
    Note: Skip this step if you're testing this procedure or you don't want to stop or reboot your instance.
  3. Choose Actions, Image, and then Create Image.
  4. Enter an Image name and Image description.
  5. Choose the No reboot option if you're testing this procedure or you don't want to stop or reboot the instance.
  6. Choose Create Image.
  7. Choose View pending image ID to view the AMI creation Status. 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 that 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. Then, to continue, choose Next: Configure Security Group.
  7. 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.
  8. Choose Launch.
  9. In Select a key pair, choose your key pair from the drop-down menu, choose the agreement check box, and then choose Launch Instances.
  10. In Launch Status, choose the instance ID to find the Instance State status.

Reassign the Elastic IP address

  1. From the left navigation pane, choose Elastic IPs.
  2. Choose the Elastic IP address for the instance you are moving, choose Actions, Disassociate address, and then confirm by choosing Disassociate address.
  3. Associate the address to the new instance by choosing Actions, and then choosing Associate address.
  4. On the Associate address page:
    For Resource type, choose the Instance radio button.
    For Instance, choose your new instance name.
    For Private IP, choose the new IP.
    For Reassociation, choose Allow Elastic IP to be reassociated if already attached, and then choose Associate.

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center.

Published: 2018-06-14

Updated: 2018-11-08