Compared with Elastic Compute Service (ECS) instances in the classic network, ECS instances in virtual private clouds (VPCs) are more secure and support additional features such as associating elastic IP addresses (EIPs). If you need better network control, higher security and isolation, and more flexible resource deployment, you can upgrade your instances from the classic network to a VPC. This topic describes how to use a migration plan to migrate one or more ECS instances from the classic network to a VPC.
Prerequisites
The ECS instances that you want to migrate from the classic network to a VPC meet the following requirements:
No local disks are attached to the instances. If local disks are attached to the instances,
submit a ticket to contact Alibaba Cloud technical support to migrate the instances.
NoteFor information about how to check whether local disks are attached to an ECS instance, see the FAQ section of this topic.
The instances are allocated a public bandwidth of more than 0 Mbit/s. If an ECS instance has a public IP address and a public bandwidth of 0 Mbit/s, you must upgrade the public bandwidth before you migrate the instance. For more information, see the Modify the maximum public bandwidth section of the "Overview of instance configuration changes" topic.
The instances are located in one of the following regions that support the migration plan feature: China (Qingdao), China (Beijing), China (Hangzhou), China (Shanghai), China (Shenzhen), China (Hong Kong), US (Silicon Valley), and Singapore.
ImportantSome instances located in Hangzhou Zone C cannot be migrated from the classic network to VPCs.
Preparations
Create snapshots for the disks on the ECS instances to be migrated to back up data.
For more information, see Create a snapshot for a disk.
NoteYou are charged for the snapshots. For more information, see Snapshots.
(Required) If an ECS instance that you want to migrate is associated with an Alibaba Cloud database service, you must enable the hybrid access mode for the database service before you migrate the instance.
In hybrid access mode, Alibaba Cloud database services can be accessed by ECS instances that reside in the classic network or VPCs. For more information, see Hybrid access to ApsaraDB services.
(Required) If an ECS instance that you want to migrate is associated with an Alibaba Cloud database service (such as ApsaraDB RDS) that provides the whitelist feature, you must add the CIDR block of the destination vSwitch to a whitelist of the database service before you migrate the instance.
For more information, see Configure a whitelist.
(Optional) To ensure that services can be rapidly restored after migration, we recommend that you configure application services to run on instance startup and monitor service availability.
Disable or uninstall server security software on the ECS instances to be migrated.
NoteThe device drivers of ECS instances are updated when the instances are migrated. You must disable or uninstall security software such as Safedog, Huweishen, and Yunsuo on the instances in advance.
Reserve at least 500 MiB of free space on the system disk of each ECS instance that you want to migrate. If less than 500 MiB of free space is reserved on the system disk of each ECS instance that you want to migrate, virtualization drivers may fail to be installed and may be unable to start.
Make sure that the destination vSwitch has sufficient internal IP addresses available. The number of available internal IP addresses must be greater than that of ECS instances to be migrated.
Step 1: Understand the impacts of the migration
After you migrate ECS instances from the classic network to a VPC, the status, network type, and IP addresses of the instances change. Familiarize yourself with the impacts of migration before you migrate ECS instances.
Item | Description |
Period of time that is required to migrate an instance | Approximately 15 minutes are required from the time when the instance is stopped in the classic network until the time when the instance is migrated to a VPC and started in the VPC. Important
|
Instance status | During the migration, the instance that is migrated is stopped and then restarted. We recommend that you migrate your instance during off-peak hours. |
Network type | After an instance is migrated, the network type of the instance changes from classic network to VPC. For information about VPCs, see What is a VPC? Important After you migrate an instance from the classic network to a VPC, you cannot migrate the instance back to the classic network. |
Software authorization codes | After the instance is migrated, its software authorization codes may change. |
Public and internal IP addresses |
|
Device names of disks |
|
Fees |
|
Others |
|
Step 2: Create a migration plan
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 Precautions dialog box, select I have read and understood the precautions and click Create Migration Plan.
In the Configure Migration Plan step, configure parameters and click Next.
In the Destination Zone and VPC section, configure the parameters.
Parameter
Description
Plan Name
Enter a name for the migration plan.
Select a destination zone
Select a destination zone from the drop-down list. The available zones are automatically planned and displayed based on resource availability. If you want to specify a zone that is not in the drop-down list,
NoteOnly one zone can be specified in each migration plan. If you want to migrate multiple ECS instances to different zones, you must create multiple migration plans.
Destination VPC or Create a VPC
Select a destination VPC from the drop-down list. The CIDR block of the selected VPC determines whether the internal IP addresses of the ECS instances from the classic network can be retained.
If you want to retain the internal IP addresses of the ECS instances, you must select a VPC that is associated with the 10.0.0.0/8 CIDR block. You can select the default option or a VPC that you created.
If you have not created VPCs that are associated with the 10.0.0.0/8 CIDR block, select (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8. Then, a VPC that is associated with the 10.0.0.0/8 CIDR block is automatically created.
If you have created a VPC that is associated with the 10.0.0.0/8 CIDR block, select the VPC.
If you do not want to retain the internal IP addresses of the ECS instances, you must select a VPC that is associated with a CIDR block other than 10.0.0.0/8.
In the Instance Network Properties section, configure the parameters.
Parameter
Description
Destination Security Group
Specify destination security groups. Valid values:
(Default) Clone Security Groups of Classic Network-type Instances: The security groups of the ECS instances are automatically cloned from the classic network to the destination VPC. The rules of the new security groups (clone security groups) in the VPC are the same as the rules of the original security groups in the classic network.
ImportantIf the original security groups in the classic network are referenced by managed security groups or contain rules that reference a managed security group, the original security groups cannot be cloned to the destination VPC.
If you set Destination VPC or Create a VPC to (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8, Destination Security Group is automatically set to (Default) Clone Security Groups of Classic Network-type Instances and cannot be modified.
Specify Security Groups: Select one or more existing security groups from the drop-down list.
ImportantImproper security group settings affect the connectivity of ECS instances. Make sure that your security group rules meet your connectivity requirements.
Mac Address Retention Policy
Select the media access control (MAC) address that you want to retain for each ECS instance from the classic network. In the classic network, an ECS instance has a public MAC address and a private MAC address if the instance is assigned a public IP address. In a VPC, each ECS instance has only a private MAC address and can use a NAT device to map the internal IP address of the instance to a public IP address for Internet access.
You can select (Default) Private Mac Address or Public Mac Address based on your business requirements.
If your business system is associated with a MAC address, retain the MAC address. For example, your software is associated with a MAC address for registration.
(Default) Private Mac Address: The private MAC addresses of the ECS instances are retained regardless of whether the instances have public MAC addresses.
Public Mac Address: If the ECS instances have public MAC addresses, the public MAC addresses are retained. If the ECS instances do not have public MAC addresses, the private MAC addresses of the instances are retained.
If your business system is not associated with a MAC address, select (Default) Private Mac Address or Public Mac Address.
In the Instance Network Connectivity section, configure the parameters. Then, click Next.
Parameter
Description
Retain Internal IP Address
Specify whether to retain the internal IP addresses of the ECS instances from the classic network. If you want to retain the internal IP addresses of the ECS instances, you must specify how to create a vSwitch. If you do not want to retain the internal IP addresses of the ECS instances, you must select a vSwitch from the drop-down list.
(Default) Yes: retains the internal IP addresses of the ECS instances from the classic network. If you select (Default) Yes, you must configure vSwitch Creation Policy.
If you set vSwitch Creation Policy to Automatic, a vSwitch is automatically created and associated with a CIDR block based on the internal IP addresses of the ECS instances. Make sure that the CIDR block corresponding to the internal IP addresses of the ECS instances is not used by other vSwitches. If the CIDR block is used by other vSwitches, the vSwitch cannot be created.
NoteIf you set Destination VPC or Create a VPC to (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8, Retain Internal IP Address is automatically set to (Default) Yes, and vSwitch Creation Policy is automatically set to Automatic and cannot be modified.
If you set vSwitch Creation Policy to Manual, you must create a vSwitch in the specified destination zone based on the internal IP addresses of the ECS instances.
NoteYou can set vSwitch Creation Policy to Manual only when you select a user-created VPC that is associated with the 10.0.0.0/8 CIDR block for Destination VPC or Create a VPC.
No: does not retain the internal IP addresses of the ECS instances from the classic network. You must select a vSwitch from the drop-down list.
NoteIf you cannot find the vSwitches that you created in the drop-down list, the reason may be that the vSwitches do not reside in the specified destination zone. Create a vSwitch in the destination zone. For more information, see Create and manage a vSwitch.
Ensure interconnections between the migrated instances and the classic network-type instances
Specify whether to allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan. Configure this parameter based on the value of Retain Internal IP Address.
Retain Internal IP Address set to (Default) Yes:
If you do not want to allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan, select (Default) No.
If you want to allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan, select Yes. Then, select all ECS instances in the classic network that require mutual access over the internal network in the Select Instances step. You can schedule different migration time for the instances to specify the order in which to migrate the instances.
NoteECS instances in the classic network that are not included in the migration plan cannot communicate with the ECS instances that are migrated to the specified VPC over the internal network. After this migration plan is created, ECS instances cannot be added to the plan.
Retain Internal IP Address set to No:
If you do not want to allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan, proceed to the Select Instances step.
If you want to allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan, configure ClassicLink to link the instances to the specified VPC before you migrate the instances. For more information, see Connect an instance in a classic network to a VPC.
In the Select Instances step, select ECS instances and click Next.
If you set Retain Internal IP Address to (Default) Yes and allow mutual access over the internal network between migrated instances and unmigrated instances that are included in the migration plan, you must select all ECS instances in the classic network that require mutual access over the internal network. You can schedule different migration times for the instances to specify the order in which to migrate the instances.
NoteECS instances in the classic network that are not included in the migration plan cannot communicate with the ECS instances that are migrated to the specified VPC over the internal network. After the migration plan is created, ECS instances cannot be added to the plan.
In the following figure, the section that is labeled ① indicates the instances that you want to migrate in the first batch, and the section that is labeled ② indicates the instances that you want to migrate in subsequent batches.
In the Scheduled Migration step, specify the migration time for the instances and click Verify.
The instances are stopped and then started again during the migration process. We recommend that you schedule the migration task for your instances during off-peak hours. A unique migration time can be specified for each instance.
To specify a migration time for only a single instance, click Schedule Migration Time in the Actions column corresponding to the instance.
To specify a migration time for multiple instances that you want to migrate in a batch, select the instances and click Batch Schedule Migration Time.
ImportantFor ECS instances that need to remain in the classic network and communicate with the ECS instances that are migrated by this migration plan, specify a late migration time. Before the migration time, determine whether to migrate the ECS instances from the classic network.
The following limits apply to the migration time that can be specified for each instance:
The migration time cannot be earlier than the local time.
The migration time cannot be later than the expiration time of the instance.
After the migration plan is created, the replicas of some disks are checked. The period of time that is required by the check is determined based on the disk size and the number of disks that are queued for the check. The migration starts after the check is complete. Set migration times as prompted.
In the Verify dialog box, read the migration considerations and verify whether your migration plan meets the specified requirements.
If your migration plan meets the specified requirements, select options and click Confirm and Create.
If your migration plan does not meet the requirements, error messages are displayed. You can troubleshoot the errors based on the error messages and modify parameters to create the migration plan again.
Step 3: Complete the migration
After the migration plan is created, the system migrates the specified ECS instances from the classic network to the destination VPC at the specified times.
During the migration, the system performs the operations shown in the following figure.
If an instance is migrated across zones, the system continues to migrate disk data of the instance after the computing resources and network resources of the instance are migrated and the instance is started. In most cases, approximately 4 hours are required to migrate 100 GiB of disk data. During the migration of disk data, the I/O performance of disks degrades and snapshot-related and disk-related features are not supported. You can use the instance as expected when the disk data is being migrated.
Step 4: Verify the migration result
In the left-side navigation pane, choose .
Find the migrated ECS instances and click the ID of each of these instances.
On the Instance Details page, check whether the network type of the instance is VPC.
If the instance is migrated to the specified VPC, the network type of the instance changes to VPC.
Check the internal network and business runtime environments.
Scenario
Migration plan
What to do next
Migrate all ECS instances from the classic network to a VPC
Set Destination VPC or Create a VPC to (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8.
Set Ensure interconnections between the migrated instances and the classic network-type instances to (Default) No.
Check whether your business system runs as expected.
Migrate some ECS instances to a VPC and retain other ECS instances in the classic network
Set Destination VPC or Create a VPC to (Default) Automatically create a VPC, CIDR block: 10.0.0.0/8.
Set Ensure interconnections between the migrated instances and the classic network-type instances to Yes.
Check whether your business system runs as expected.
Other scenario
Set Destination VPC or Create a VPC to a VPC that is associated with a CIDR block other than 10.0.0.0/8.
Check network connectivity.
In this scenario, Retain Internal IP Address is unsupported. If your business is connected by using internal IP addresses, you must configure new internal IP addresses.
Check whether your business system runs as expected.
What to do next
If an ECS instance runs a Linux operating system and is assigned a different internal IP address after the instance is migrated, you must modify the /etc/hosts file of the instance.
Run the
vi /etc/hosts
command to open the hosts file.Press the I key to enter Insert mode.
Change the original internal IP address to the new internal IP address for the instance.
Press the Esc key to exit Insert mode.
Enter :wq and press the Enter key.
If you set Retain Internal IP Address to No in the migration plan, remove the internal IP addresses that are no longer used from the whitelists of other cloud services after the migration.
Common services that support whitelists include ApsaraDB RDS, SLB, and Object Storage Service (OSS).
If an instance is migrated across zones, its connectivity with other Alibaba Cloud services such as ApsaraDB RDS, ApsaraDB for Redis, and ApsaraDB for MongoDB may be affected. Adjust application configurations at the earliest opportunity. For example, you can migrate the corresponding RDS instances to the same zone as the ECS instance to ensure connectivity.
For more information, see Migrate an ApsaraDB RDS for MySQL instance across zones.
If you have not restarted an instance or upgraded its kernel for an extended period of time, issues may occur after the instance is migrated. For example, a file system check (fsck) may be performed, configuration changes may become invalid, or the instance may be unable to start.
Software authorization codes change because network interfaces are deleted.
If software is associated with a MAC address on your ECS instance and the software vendor approves the migration certificate that is issued by Alibaba Cloud, you can re-authorize the instance to use the software. If an error occurs, you must modify the configurations or roll back the instance.
If you have not restarted an ECS instance for an extended period of time or after the kernel is upgraded, the system checks the file systems of the instance and updates the configurations of the instance when the instance is restarted. If your ECS instance cannot be started, submit a ticket
at the earliest opportunity to contact Alibaba Cloud.