Compared with Elastic Compute Service (ECS) instances that reside in the classic network, ECS instances that reside in virtual private clouds (VPCs) are more secure and support additional features such as associating elastic IP addresses (EIPs). 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.
    Note For information about how to check whether local disks are attached to an instance, see the FAQ section of this topic.
  • An amount of public bandwidth that is greater than 0 Mbit/s is allocated to the instances. 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 Modify public bandwidth.
  • The instances reside 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 (Singapore).
    Important Some ECS instances that reside in Hangzhou Zone C cannot be migrated from the classic network to VPCs.

Preparations

  1. Create snapshots for the disks on the ECS instances to be migrated to back up data.
    For more information, see Create a snapshot of a disk.
    Note You are charged for the snapshots. For information about the pricing of snapshots, see Snapshots.
  2. Optional: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 in advance.

    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.

  3. Optional: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 in advance.

    For more information, see Configure a whitelist.

  4. Optional:To ensure that services can be quickly restored after migration, we recommend that you configure application services to automatically start on instance startup and monitor the availability of the application services.
  5. Disable or uninstall server security software on the ECS instances to be migrated.
    Note The 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.
  6. 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.
  7. Make sure that the destination vSwitch has sufficient internal IP addresses available. The number of the available internal IP addresses must be greater than that of ECS instances to be migrated.

Step 1: Understand the impacts of the migration

Important After you migrate ECS instances from the classic network to a VPC, the status, network type, and IP addresses of the instances change. Understand the impacts of migration before you migrate ECS instances.
ItemDescription
Period of time that is required to migrate an instanceApproximately 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
  • If the instance is started in the VPC, the computing resources and network resources of the instance are migrated to the VPC, and you can use the instance as expected.
  • If the instance is migrated across zones, the system continues to migrate disk data of the instance after 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 operations cannot be performed. You can use the instance as expected when the disk data is being migrated.
Instance statusDuring the migration process, the instance that is migrated is stopped and then started again. We recommend that you migrate your instance during off-peak hours.
Network typeAfter 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?.
Software authorization codesAfter an instance is migrated, the authorization codes of software on the instance may change.
Public and internal IP addresses
  • Public IP address: After an instance is migrated, the public IP address of the instance remains unchanged.
    Important ECS instances that reside in VPCs do not have public network interfaces, and use NAT devices for Internet access. You can find only internal IP addresses in the instances. If a public IP address that can be viewed in the instance operating system is required for your applications, reconsider whether to migrate your instance from the classic network to a VPC.
  • Internal IP address: You can specify whether to retain the internal IP address of an instance when you create a migration plan to migrate the instance. You can also change the internal IP address of the instance after the instance is migrated. For more information, see Modify a private IP address.
Device names of disks
  • Linux instances: The underlying virtualization technology of some ECS instances is upgraded when the instances are migrated from the classic network to VPCs. This may cause the device names of the disks on the instances to change. On Linux instances, disks are assigned device names from the range vd[a-z] that uniquely identify the disks.
    • If the disks of a Linux are assigned device names in the vd? format before the instance is migrated, the device names of the disks remain unchanged after the instance is migrated.
    • If the disks of a Linux instance are assigned device names in the xvd? format before the instance is migrated, the device names of the disks are converted to the vd? format, such as vda, vdb, or vdc, after the instance is migrated. Alibaba Cloud updates the /etc/fstab file for Linux instances. You must check whether your applications are dependent on the original device names of the disks.
  • Windows instances: The device names of disks are not affected.
Fees
  • You are not charged for the migration. After a subscription instance is migrated from the classic network to a VPC, a new billing cycle starts and the unit price of the instance type changes. The fees that are incurred for the instance are less in a VPC than in the classic network.
  • If renewal orders or configuration change orders that were placed for an instance do not take effect or payment is not completed for the orders, the orders are canceled when the instance is migrated. You can renew the instance and change the configurations of the instance after the instance is migrated.
Others
  • The ID, username, and logon password of the ECS instance that is migrated remain unchanged.
  • If the ECS instance is added to the vServer group of a Server Load Balancer (SLB) instance before the ECS instance is migrated, the ECS instance is not automatically associated with the SLB instance after the ECS instance is migrated. You must add the ECS instance to the vServer group of the SLB instance. For more information, see Modify a vServer group.

Step 2: Create a migration plan

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Maintenance & Monitoring > Migration Plan.
  3. In the top navigation bar, select a region.
  4. Click Create Migration Plan.
  5. On the Precautions dialog box, select I have read and understood the precautions. and click Create Migration Plan.
    Precautions
  6. In the Configure Migration Plan step, configure parameters and click Next.
    1. Configure the parameters in the Destination Zone and VPC section.
      Destination Zone and VPC section
      ParameterDescription
      Plan NameEnter a name for the migration plan.
      Select a destination zoneSelect 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, submit a ticket.
      Note Only a single 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 VPCSelect 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.
    2. Configure the parameters in the Instance Network Properties section.
      Instance Network Properties section
      ParameterDescription
      Destination Security GroupSpecify 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.
        Important
        • If 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.
        Important Improper security group settings affect the connectivity of ECS instances. Make sure that your security group rules meet your connectivity requirements.
      Mac Address Retention PolicySelect the 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.
    3. Configure the parameters in the Instance Network Connectivity section.
      Instance Network Connectivity section
      ParameterDescription
      Retain Internal IP AddressSpecify 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 vSwitch Creation Policy is set 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.
          Note If 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 vSwitch Creation Policy is set to Manual, you must create a vSwitch in the specified destination zone based on the internal IP addresses of the ECS instances.
          Note You 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.
        Note If 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 instancesSpecify 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
          Note ECS 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. 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 them. For more information, see Connect a classic network to a VPC.
  7. 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.
    Note ECS 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. After the migration plan is created, ECS instances cannot be added to the plan.

    In the following figure, the section that is labeled ① indicate 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.

    Select Instances
  8. 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.
    • To specify the migration time for all instances, click Set Unified Migration Time.
    Important
    • For 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. Follow the on-screen instructions to specify the migration time.

  9. 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. The migration is complete
During the migration, the system performs the following operations:
  1. Stop the ECS instances to be migrated.
  2. Migrate the computing and network resources of the ECS instances.
  3. Start the migrated ECS instances.
  4. Continue to migrate the disk data of the ECS instances.
  5. Complete the migration.
Note If the 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 process 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

  1. In the left-side navigation pane, choose Instances & Images > Instances.
  2. Find the migrated ECS instances and click the ID of each of these instances.
  3. 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 results
  4. Check the internal network and business runtime environments.
    ScenarioMigration planWhat 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 normally.
    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 normally.
    Other scenarioSet Destination VPC or Create a VPC to a VPC that is associated with a CIDR block other than 10.0.0.0/8.
    1. Check network connectivity.
    2. In this scenario, Retain Internal IP Address cannot be set to No. If your business is connected by using internal IP addresses, you must configure new internal IP addresses.
    3. Check whether your business system runs normally.

What to do next

  1. 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. Modify hosts
    1. Run the vi /etc/hosts command to open the hosts file.
    2. Press the I key to enter the edit mode.
    3. Change the original internal IP address to the new internal IP address for the instance.
    4. Press the Esc key to exit the edit mode.
    5. Enter :wq and press the Enter key.
  2. 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).

  3. 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 in a timely manner. 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 in the same region.

  4. If you have not restarted an instance or upgraded its kernel for an extended period of time, problems 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.
  5. Optional: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.

  6. Optional: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 in a timely manner to contact Alibaba Cloud.

FAQ

Why am I unable to open websites, use services, or read data from or write data to databases on an instance after the instance is migrated from the classic network to a VPC?

This issue may occur because traffic is not allowed on the required communication ports in the new security groups of your instance. We recommend that you clone the original security group rules of the instance from the classic network. For more information, see Clone a security group.

After an instance is migrated, some software cannot be used and I am prompted that the authorization code is expired or invalid or that no authorization code exists for the software. Why?

  • The software vendor did not approve the migration certificate that is issued by Alibaba Cloud. We recommend that you contact the software vendor or channel partner to submit a verification form for re-authorization.
  • The software is associated with a MAC address to register to your instance. Some software is registered by using associated MAC addresses to valid environments. After an ECS instance is migrated to a VPC, only the public or private MAC address of the instance is retained. If the MAC address with which a piece of software is associated for registration is deleted, an authorization error occurs. We recommend that you contact the software vendor to check whether the software is associated with a MAC address to be registered to your instance. If the software is associated with a MAC address to be registered to your instance, you must re-associate the MAC address of the instance with the software. For more information, see Overview.

Why am I no longer able to use the FTP service on an instance after the instance is migrated?

After your ECS instance is migrated, the public network interface is deleted and the FTP service becomes unavailable. We recommend that you perform the following operations:
  1. Convert the system-assigned public IP address of the instance to an EIP.
  2. Associate an EIP with a secondary ENI of the instance in cut-through mode.
Note Some retired instance types and entry-level instance types of the previous generation do not support ENIs. If the instance type of your instance does not support ENIs, upgrade the instance to an instance type that supports ENIs before you perform the preceding operations. For more information, see Overview of instance configuration changes.

What do I do if I cannot find data disks on some Windows instances after the instances are migrated.

After some Windows instances are migrated, the disks that are attached to the instances are disconnected. We recommend that you perform the following steps to configure the disks to automatically reconnect online. For more information, see Methods for processing offline disks on Windows ECS instances.

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Maintenance & Monitoring > Cloud Assistant.
  3. Click Create or Run Command to create and run a Cloud Assistant command.
    In the Create Command panel, configure the parameters. The following table describes the parameters. For the parameters that are not described in the table, accept the default values. For more information, see Use the immediate execution feature.
    ParameterValue
    Command TypePowerShell
    Command Content
    @("san policy=onlineall") |diskpart
    Select InstancesOne or more Windows instances.
  4. Click Execute and Save.

Why am I unable to transfer files to an instance or from an instance over FTP after the instance is migrated from the classic network to a VPC?

ECS instances in the classic network have both public network interfaces and private network interfaces. ECS instances in VPCs have only private network interfaces. If your applications are configured to recognize only public IP addresses, you must reconfigure the applications.

Most FTP clients access FTP servers in passive mode. In passive mode, FTP servers must communicate their IP addresses to FTP clients. In VPCs, public IP addresses cannot be recognized and FTP servers send their internal IP addresses to FTP clients. When the clients use the internal IP addresses to access the servers, errors occur.

When you use an ECS instance that resides in a VPC as an FTP server, we recommend that you communicate the public IP address of the instance to the FTP server program. The procedures that are required to communicate the public IP addresses of ECS instances vary based on the types of FTP server programs. Select a procedure that is suitable for your FTP server program. In the following example, vsftpd is used. Open the configuration file of vsftpd and add the following content to the file:
listen_ipv6=NO
pasv_address=<PublicIP>
Note Replace <PublicIP> with the system-assigned public IP address or EIP of your instance. If an EIP is associated with the instance, we recommend that you use the EIP.

How do I check whether local disks are attached to an instance?

  1. Log on to the ECS console.
  2. In the left-side navigation pane, choose Instances & Images > Instances.
  3. On the Instances page, find the instance and check the Specifications column for local disk information.
    If local disk information is displayed in the Specifications column, local disks are attached to the instance. If no local disk information is displayed in the Specifications column, local disks are not attached to the instance. Instance that uses local disks

References