All Products
Search
Document Center

Server Migration Center:Migrate servers between ECS instances

Last Updated:Feb 08, 2024

You can use Server Migration Center (SMC) to migrate servers in data centers, on-premises VMs, or servers on third-party cloud platforms to Alibaba Cloud. You can also migrate an Elastic Compute Service (ECS) instance to another ECS instance within the same Alibaba Cloud account or across different Alibaba Cloud accounts. This topic describes how to use SMC to migrate servers between ECS instances within an Alibaba Cloud account or across different Alibaba Cloud accounts.

Prerequisites

The preparations for the migration are complete. For example, an Alibaba Cloud account is created, real-name verification is complete, Resource Access Management (RAM) is activated, and SMC is authorized to access your cloud resources. For more information, see Before you begin.

Background information

To migrate servers between ECS instances, we recommend that you copy an image from a region to another within an Alibaba Cloud account, or share an image with a different Alibaba Cloud account. For more information, see Copy an image and Share a custom image. If the preceding methods do not meet your requirements, you can follow the instructions provided in this topic to migrate servers between ECS instances.

When you use SMC, you are charged only for the ECS resources that you use during the migration. For more information, see Billing.

Usage notes

If you migrate a server for the first time, we recommend that you perform a test migration. Before you start the migration job, take note of the information in the following table.

Item

Description

Username

If you migrate servers between ECS instances across different Alibaba Cloud accounts, you must download and install an SMC client on the source ECS instance. Then, you need to enter the AccessKey pair of the Alibaba Cloud account that owns the destination ECS instance.

Data security

To prevent data loss, we recommend that you create snapshots for your cloud disk. For information about how to create snapshots, see Create a snapshot of a disk.

Migration speed

During the migration, the network environment, CPU, memory, and disk performance of the source server affect the migration speed.

  • If you perform migration across regions outside the Chinese mainland, the network may be unstable.

  • If a virtual private cloud (VPC) is available, we recommend that you perform migration over the VPC. Compared with migration over the Internet, migration over a VPC is more efficient and stable.

For more information, see Estimate the time required for migration and test the data transfer speed.

IP addresses

After the migration is complete, the public and private IP addresses are reassigned when you use an image to create an ECS instance.

  • If you want to keep the public IP address unchanged, we recommend that you use an elastic IP address (EIP). After the server is migrated, disassociate the EIP from the ECS instance, and then associate the EIP with the ECS instance that you create. For more information, see Associate or disassociate an EIP.

  • If you want to keep the private IP address unchanged, you can modify the private IP address after the migration is complete. For more information, see Modify a private IP address.

Underlying hardware

After the migration is complete, the application licenses that are associated with the underlying hardware may become invalid.

Scenarios

You can migrate servers between ECS instances in the following scenarios:

  • Scenario 1: Migrate servers between ECS instances across different Alibaba Cloud accounts

    In this scenario, you can migrate servers between ECS instances across different Alibaba Cloud accounts. The ECS instances can reside in the same region or different regions. For example, you can migrate an ECS instance that belongs to Alibaba Cloud Account A to another ECS instance that belongs to Alibaba Cloud Account B.

  • Scenario 2: Migrate servers between ECS instances within an Alibaba Cloud account

    In this scenario, you can migrate servers between ECS instances within the same Alibaba Cloud account. The ECS instances can reside in the same region or different regions. For example, you can migrate an ECS instance to an ECS image or another ECS instance within Alibaba Cloud Account A.

    In this scenario, you can also shrink the disk of an ECS instance by migrating the ECS instance to a custom image or another ECS instance that has a smaller disk. This is because ECS does not support system disk shrinking or data disk shrinking. For more information, see Shrink a disk.

Step 1: Import the information about a migration source

Perform the operations for importing the information about a migration source based on the migration scenario in which you migrate servers between ECS instances within an Alibaba Cloud account or across different Alibaba Cloud accounts.

Migrate servers between ECS instances within an Alibaba Cloud account

Multiple methods are supported in SMC to import the information about a migration source. For more information, see the following topics:

We recommend that you migrate servers between ECS instances within an Alibaba Cloud account in the SMC console. To do so, perform the following steps:

  1. Log on to the SMC console.

  2. In the left-side navigation pane, click Migration Sources.

  3. On the Migration Sources page, click Import Migration source to import the source ECS instance.

  4. Configure the parameters based on the type of your migration source. The following table describes the parameters.

    Parameter

    Description

    Migration Source Type

    The type of the migration source. Select ECS. By default, Install SMC Client is selected.

    Important

    The SMC client allows you to migrate servers or operating systems, migrate ECS instances across zones, or migrate your source server to Alibaba Cloud WUYING Workspace. If the SMC client is not installed, you can only migrate ECS instances across zones.

    Import Method

    The method that is used to import the information about the migration source. Select Import through Console.

    Region

    The region in which the source ECS instance resides.

    Instance

    The ECS instance whose information you want to import to SMC. You can select multiple ECS instances to import the information about the ECS instances at a time.

    You can enter the instance ID, instance name, private IP address, public IP address, or elastic IP address (EIP) in the search box to search for an ECS instance.

  5. After you configure the parameters, click Import.

    The import process takes about 3 to 10 minutes. Wait until the migration source is imported.

    • You can view the import status on the Migration Sources page. If the value in the Migration Source Status column changes from Importing to Online for a migration source, the information about the migration source is imported.

      image..png

    • If the value in the Migration Source Status column is Import Failed for a migration source, you can click the adad56 icon to view the error message, troubleshoot the error based on the error message, and then import the information about the migration source again. If the information about the migration source fails to be imported or an error occurs during the migration, you can check the log files in the directory of the SMC client for more information. By default, the SMC client is installed in the following directory:

      • Windows: C:\smc

      • Linux: /smc

    For more information, see Troubleshooting and FAQ.

    Note

    The information about ECS instances whose information has been imported to SMC cannot be imported again. If you select one or more ECS instances whose information has been imported to SMC, a message appears to notify you.

Migrate servers between ECS instances across different Alibaba Cloud accounts

Multiple methods are supported in SMC to import the information about a migration source. For more information, see the following topics:

We recommend that you migrate servers between ECS instances across different Alibaba Cloud accounts by using the CLI. To do so, perform the following steps:

Important

If you want to use the SMC client to import a migration source, you need to download and install an SMC client on the source ECS instance. Then, you need to log on to the SMC console by using the Alibaba Cloud account that owns the destination ECS instance and create a migration job. When you import the information about a migration source, you must enter the activation code or the AccessKey pair of the Alibaba Cloud account that owns the destination ECS instance.

  1. Log on to the SMC console by using the Alibaba Cloud account that owns the destination ECS instance.

    Important

    You must distinguish the Alibaba Cloud accounts that own the source and destination ECS instances.

  2. In the left-side navigation pane, click Migration Sources.

  3. On the Migration Sources page, click Import Migration source to import the source ECS instance.

  4. Configure the parameters to obtain the activation code.

    The following table describes the parameters.

    Parameter

    Description

    Migration Source Type

    The type of the migration source. Select ECS Instance.

    Import Method

    The method that is used to import the information about the migration source. Select Use CLI to Import Server.

    Migration Source Quota

    The number of migration sources whose information can be imported by using the activation code. Valid values: 1 to 1000. Default value: 10.

    Validity Period

    The validity period of the activation code. Unit: days. Valid values: 1 to 90. Default value: 30.

    Activation Code

    Generate the activation code and copy the command by performing the following steps:

    1. Click Generate.

    2. Click the Linux Shell or Windows Powershell tab based on the OS of the server.

    3. Click Copy to copy the command.

  5. Connect to the source server and run the copied command as an administrator to import the information about the migration source.

    Perform the operations to import the information about a migration source based on the OS of the source server.

    • Linux:

      1. Connect to the Linux server.

        Important

        You must distinguish the Alibaba Cloud accounts that own the source and destination ECS instances.

      2. Run the copied command as an administrator to import the information about the migration source.

        The specific command that is copied in the console prevails.

        wget https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/run_smc_client.sh -O ./run_smc_client.sh && bash ./run_smc_client.sh --accesstokenid=at-bp12x2ptec97stff**** --accesstokencode=TpGbQmQnOlvLpj4H0ayuz825Oei1****

        The following sample command output indicates that the import is successful:

        [2022-08-11 14:40:45] [Info]  Snapshot Check...
        [2022-08-11 14:40:49] [Info]  Verify User Account...
        [2022-08-11 14:40:49] [Info]  Generate SSH Key...
        [2022-08-11 14:40:49] [Info]  Import Source Server...
        [2022-08-11 14:40:49] [Info]  Import Source Server [s-bp18x8751kgz2oyh****] Successfully!
        [2022-08-11 14:40:50] [Info]  =========   Run In BackGround Daemon Mode   =========
        [2022-08-11 14:40:50] [Info]  Goto Aliyun Begin...
        [2022-08-11 14:40:50] [Info]  Check Source Server Status...
        [2022-08-11 14:40:50] [Info]  Check Replication Job Status...
        Please Goto SMC Console To Create New Job, time: 1m0s    -
        Note

        If the migration source fails to be imported or an error occurs during the migration, you can check the log files in the directory of the SMC client for more information. By default, the SMC client is installed in the /smc directory on a Linux server.

    • Windows:

      1. Connect to the Windows server and start Windows PowerShell as an administrator.

        Important

        You must distinguish the Alibaba Cloud accounts that own the source and destination ECS instances.

      2. Run the copied command to import the information about the migration source.

        The specific command that is copied in the console prevails.

        Invoke-WebRequest -Uri https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/run_smc_client.ps1 -OutFile 'C:\run_smc_client.ps1'; C:\run_smc_client.ps1  -accesstokenid at-bp170s4olpmm35lb**** -accesstokencode y1W4e5dxWZUBkmiWoH7tA2X2dldG****

        The following sample command output indicates that the import is successful:

        Windows PowerShell
        Copyright (C) 2016 Microsoft Corporation. All rights are reserved. 
        
        PS C:\Users\Administrator> Invoke-WebRequest -Uri https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/run_smc_client.ps1
        -OutFile 'C:\run_smc_client.ps1'; C:\run_smc_client.ps1  -accesstokenid at-bp12x2ptec97stff**** -accesstokencode TpGbQmQ
        nOlvLpj4H0ayuz825Oei1****
        [2023-01-06 13:53:56] [info] start download smc client
        [2023-01-06 13:53:59] [Info]  ========= Goto Aliyun Client 2.6.5. =====
        [2023-01-06 13:53:59] [Info]  Load User Config...
        [2023-01-06 13:53:59] [Info]  Load Client Data...
        [2023-01-06 13:53:59] [Info]  Check System Info [Windows Server 2016 x8
        OS Info: Microsoft Windows Server 2016,  (10.0.14393 )
        CPU Info: Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
        CPU Usage: 2 Cores (1.54%) Memory Usage: 1.53GB/8.00GB (19.13%)
        Hostname: test0 IP Address: 192.168.XX.XX Mac Address: 00163E10****
        [2023-01-06 13:54:00] [Info]  Verify User Account...
        [2023-01-06 13:54:00] [Info]  Generate SSH Key...
        [2023-01-06 13:54:01] [Info]  Import Source Server...
        [2023-01-06 13:54:01] [Info]  Import Source Server [s-bp19rlidl3mwuptc****] Successfully!
        [2023-01-06 13:54:02] [Info]  =========   Run In Daemon Mode   ========
        [2023-01-06 13:54:02] [Info]  Goto Aliyun Begin...
        [2023-01-06 13:54:02] [Info]  Check Source Server Status...
        [2023-01-06 13:54:02] [Info]  Check Replication Job Status...
        Please Goto SMC Console To Create New Job, time: 4m34s    \
        Note

        If the migration source fails to be imported or an error occurs during the migration, you can check the log files in the directory of the SMC client for more information. By default, the SMC client is installed in the C:\smc directory on a Windows server.

Step 2: Create and start a migration job

  1. Log on to the SMC console by using the Alibaba Cloud account that owns the destination ECS instance.

    Important

    If you want to migrate servers between ECS instances across Alibaba Cloud accounts, you must distinguish the Alibaba Cloud accounts that own the source and destination ECS instances.

  2. In the left-side navigation pane, click Migration Sources.

  3. On the Migration Sources page, find the migration source for which you want to create a migration job and click Create Migration Job in the Actions column.

  4. In the Create Migration Job dialog box, read the instructions and configure parameters for the migration job. For more information, see Create a server migration job.

    Note

    We recommend that you select VPC as the network type when you create a migration job. Compared with migration over the Internet, migration over a VPC is more efficient and stable.

What to do next

After the migration job is complete, perform the following operations based on the specified destination type:

  • If you migrate an ECS instance to an ECS image, create an ECS instance based on the image. For more information, see Create an ECS instance by using a custom image.

  • If you migrate an ECS instance to another ECS instance, view the destination ECS instance in the ECS console.