This topic describes how to migrate a VPC-type ECS instance from one virtual private cloud (VPC) to another VPC. If you select an inappropriate VPC when you create an ECS instance or if you want to replan the network, you can use this feature to change the VPC of the instance.

Prerequisites

  • The instance is in the Stopped state. For more information, see Stop an instance.
  • The instance is not added as a backend server of an SLB instance. For more information, see Remove a backend server.
  • The secondary elastic network interfaces (ENIs) bound to the instance are unbound. Multiple secondary private IP addresses assigned to the ENIs are revoked. For more information, see Detach an ENI from an instance and Revoke secondary private IP addresses.
  • The destination VPC, VSwitch, and security groups are created and available.

Scenarios

  • You want to replan the VPCs of your ECS instances because the original VPCs are unable to keep up with the growing needs of your business.
  • In the early business stage, only one VPC was planned. Different projects and usage environments share this VPC, which leads to risks in data operations. You want to use different VPCs for different projects and environments.
  • Your ECS instances are deployed in the default VPCs in different accounts. Therefore, connectivity between instances across Alibaba Cloud accounts cannot be implemented due to IP address conflicts. In this case, you must change the VPCs of the ECS instances and resolve the address conflict before you interconnect the instances across Alibaba Cloud accounts.

Limits

  • The instance cannot be used in other cloud services. For example, the instance cannot be in the process of being migrated or having its VPC changed, or the databases deployed on the instance cannot be managed by Data Transmission (DTS).
  • After the VPC is changed, the new VSwitch of the instance must be in the same zone as the original VSwitch.
  • You can select up to five security groups in each destination VPC for an instance. However, the destination security groups must be of the same type, basic security group or advanced security group.
  • If advanced VPC features are enabled for the destination VPC, you cannot migrate instances of some instance families to the destination VPC. For more information, see Instance families that do not support advanced VPC features.
  • You can change the VPCs of up to 20 instances at a time.
  • After you change the VPC of an instance, the instance cannot communicate with other instances in the original VPC. For information about how to communicate with other instances, see What is Express Connect?.
  • The cut-through mode or multi-EIP to ENI mode cannot be enabled for the instance.
  • The instance cannot be associated with a high-availability virtual IP address (HaVip).
  • The VSwitch of the instance cannot be associated with a custom route table.
  • Global Accelerator (GA) cannot be activated for the instance.

Procedure

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. In the top navigation bar, select a region.
  4. Change the VPC of one or more ECS instances at a time.
    • Change the VPC of a single instance

      Find the target ECS instance and choose More > Network and Security Group > Change VPC in the Actions column.

    • Change the VPCs of multiple ECS instances at a time

      Select the instances whose VPCs you want to change, and choose More > Network and Security Group > Change VPC in the lower part of the page.

  5. In the Change VPC wizard, follow the instructions to change the VPCs of the ECS instances.
    Change VPC
    1. In the Prepare step, check the network information and precautions and click Next.
    2. In the Select VPC step, configure the Destination VPC, Destination VSwitch, and Destination Security Group parameters and click Next.
    3. Optional:In the Configure Primary Private IP Address step, specify a primary private IP address for each of the selected instances to use in the destination VPC.
      • The primary private IP address must be within the CIDR block of the destination VSwitch.
      • If you do not manually set the primary private IP address, it is automatically assigned by the system.
    4. Click OK.

After the change is complete, you can click the instance ID to view the new VPC and VSwitch in the Configuration Information section of the Instance Details page.