This topic describes how to migrate all Elastic Compute Service (ECS) and ApsaraDB RDS instances from the classic network to a virtual private cloud (VPC). After the instances are migrated, their business environments quickly become available.
Background information
Assume that you have created two ECS instances (ECS_A and ECS_B) and one RDS instance in the classic network. The ECS instances function as application servers, and the RDS instance functions as a database server. These instances can communicate with each other over the internal network. You want to migrate the ECS and RDS instances to a VPC and retain the internal IP addresses for the instances to ensure business stability.
Preparations
Before you migrate the instances, we recommend that you perform the following operations:
Create snapshots for all disks on the ECS instances to back up data. For more information, see Create a snapshot for a disk.
ECS instances are restarted when they are migrated. We recommend that you configure application services deployed on the instances to automatically run on system startup and monitor the availability of the services.
For more information, see Preparations in Migrate ECS instances from the classic network to a VPC.
Step 1: Migrate the ECS instances
Create a migration plan to migrate the application servers (ECS_A and ECS_B) to a VPC.
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
Click Create Migration Plan.
In the Configure Migration Plan step, configure parameters and click Next.
Configure parameters in the Destination Zone and VPC section.
Parameter
Description
Plan Name
Enter a name for the migration plan. Example: ECS_c2v_demo.
Select a destination zone
Select a destination zone from the drop-down list. Example: Shenzhen Zone B.
NoteAvailable zones are automatically planned based on resources. You can only select a zone from the drop-down list.
Only a single zone can be specified for each migration plan. If you want to specify multiple zones, you must create multiple migration plans.
Destination VPC or Create a VPC
Select (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8 from the drop-down list. Then, the system creates a VPC with the 10.0.0.0/8 CIDR block.
Configure parameters in the Instance Network Properties section.
Parameter
Description
Destination Security Group
(Default) Clone Security Groups of Classic Network-type Instances is automatically selected. This value indicates that the system clones the security groups of specified ECS instances from the classic network to the destination VPC.
NoteIf rules of a security group reference security groups as sources or destinations for traffic, the security group cannot be cloned.
Mac Address Retention Policy
Select the MAC address that you want to retain. Valid values: (Default) Private Mac Address and Public Mac Address.
If the business environments on the instances are not associated with MAC addresses, select (Default) Private Mac Address.
Configure parameters in the Instance Network Connectivity section and click Next.
Parameter
Description
Retain Internal IP Address
By default, (Default) Yes is selected, which indicates that the internal IP addresses of ECS instances to be migrated are retained.
If you set vSwitch Creation Policy to Automatic, a vSwitch is automatically created.
Ensure interconnections between the migrated instances and the classic network-type instances specified in the plan over the internal network
All ECS instances will be migrated to the specified VPC based on this migration plan, and no ECS instances will remain in the classic network. Therefore, select (Default) No.
In the Select Instances step, select the ECS_A and ECS_B instances and click Next.
In the Scheduled Migration step, set a unified migration time for the ECS instances and click Verify.
NoteThe ECS instances are restarted when they are migrated. We recommend that you migrate your ECS instances during off-peak hours.
Select the ECS instances and click Batch Schedule Migration Time.
In the Batch Schedule Migration Time dialog box, set the Migration Time parameter and click OK.
In the Verify dialog box, read the migration consideration, select the options that are displayed, and then click Confirm and Create.
NoteIf your migration plan does not meet the requirements, the system prompts an error message. You can create a migration plan again based on the error message.
After the ECS instances are migrated, you can choose
in the left-side navigation pane of the ECS console to view the instances. The network type of the instances changes to VPC, and the internal IP addresses of the instances remain unchanged.
Step 2: Migrate the RDS instance
Change the network type of the database server (RDS instance) to migrate it from the classic network to the VPC to which the ECS instances are migrated. For more information, see Change the network type.
Obtain the information of the VPC created by the system in Step 1.
In the left-side navigation pane of the ECS console, choose
.Click the ID of one of the migrated ECS instances.
On the Instance Details tab, record the VPC ID and vSwitch ID. Then, click the vSwitch ID to obtain the information of the zone in which the vSwitch resides.
Item
Example
VPC ID
vpc-wz9avqy2c3fw8w4******
vSwitch ID
vsw-wz98loggfq88msu******
Zone
Shenzhen Zone B
Obtain the network information of the RDS instance in the classic network.
Log on to the ApsaraDB RDS console.
In the left-side navigation pane, click Instances.
In the upper-left corner of the top navigation bar, select the region where the RDS instance resides.
Click the ID of the RDS instance.
View the region and zone of the RDS instance.
If the zone of the RDS instance is the same as that of the vSwitch obtained in the previous step, proceed to the next step.
If the zone of the RDS instance is different from that of the vSwitch obtained in the previous step, create a vSwitch in the zone of the RDS instance and then proceed to the next step. For information about how to create a vSwitch, see Create and manage a vSwitch.
NoteIn this example, the vSwitch and the RDS instance both reside in Shenzhen Zone B. You do not need to create a vSwitch.
In the left-side navigation pane of the page that appears, click Database Connection.
Click Switch to VPC.
In the dialog box that appears, select the VPC and vSwitch that you obtained and enable the Reserve Original Classic Network Endpoint feature. Then, click OK.
Item
Description
VPC
Select the VPC ID that you obtained in Step 1. Example: vpc-wz9avqy2c3fw8w4******.
vSwitch
Select the vSwitch ID that you obtained in Step 1. Example: vsw-wz98loggfq88msu******.
NoteIf you have created a vSwitch because the RDS instance does not reside in the same zone as the vSwitch that you obtained, select the ID of the vSwitch that you created.
Reserve original classic endpoint
Clear the option. The classic network endpoint is not retained and changes to a VPC endpoint.
NoteWhen you change the network type from classic network to VPC, a transient connection that lasts approximately 30 seconds occurs and ECS instances that reside in the classic network are immediately disconnected from the RDS instance.
Check whether the RDS instance is migrated to the VPC.
After the RDS instance is migrated, you can click Database Connection in the left-side navigation pane. On the Database Connection page of the RDS instance, the network type changes to VPC and the internal endpoint also changes.
Step 3: Check the migration result
After the ECS and RDS instances are migrated, access your business system to check whether the system runs normally.
Use a browser to access web applications.
Check whether web applications can be accessed.
If your business system runs normally, the ECS and RDS instances are migrated to the VPC.