Updated on 2024-11-14 GMT+08:00

Changing a VPC

Scenarios

This section describes how to change a VPC.

Constraints

  • Only running or stopped ECSs support VPC change.
  • A VPC can be changed for an ECS only if the ECS has one NIC.
  • If you have reinstalled or changed the OS of an ECS before changing the VPC, log in to the ECS and check whether the password or key pair configured during the reinstallation or change is successfully injected.
    • If the login is successful, the password or key pair is injected. Perform operations as required.
    • Otherwise, the system is injecting the password or key pair. During this period, do not perform any operations on the ECS.
  • During the VPC switchover, do not bind, unbind, or replace the EIP. Otherwise, a message indicating insufficient permissions will be displayed, but you do not need to take any action.
  • If an ECS NIC has an IPv6 address, the VPC of the ECS cannot be changed.

Notes

  • A VPC can be changed on a running ECS, but the ECS network connection will be interrupted during the change process.

    If you intend to change the VPC for a running ECS, the VPC change may fail when traffic is routed to the ECS NIC. In this case, you are advised to try again later or stop the ECS first and then try to change the VPC.

  • After the VPC is changed, the subnet, private IP address, MAC address, and OS NIC name of the ECS will change.
  • After the VPC is changed, the source/destination check and virtual IP address must be configured again.
  • After the VPC is changed, you are required to reconfigure network-related application software and services, such as ELB, VPN, NAT, and DNS.

Prerequisites

The target VPC, subnet, private IP address, and security group are available.

Procedure

  1. Log in to the management console.
  2. Click . Under Compute, click Elastic Cloud Server.
  3. In the ECS list, locate the row that contains the target ECS. Click More in the Operation column and select Manage Network > Change VPC.

    The Change VPC dialog box is displayed.

  4. Select an available VPC and subnet from the drop-down lists, and set the private IP address and security group as prompted.

    You can select multiple security groups. In such a case, the access rules of all the selected security groups will apply to the ECS.

    Using multiple security groups may deteriorate ECS network performance. You are suggested to select no more than five security groups.

  5. Click OK.