Help Center> Image Management Service> Best Practices> Migrating ECSs Across Accounts and Regions

Migrating ECSs Across Accounts and Regions

Context

You can migrate an ECS by deploying the services on a new ECS, using Server Migration Service (SMS), or using Image Management Service (IMS). If you want to migrate ECSs between HUAWEI CLOUD accounts in different regions, you are advised to use IMS to implement the migration.

Table 1 ECS migration methods

Migration Method

Description

Characteristics

Constraints

Deploying services on a new ECS

Purchase a new ECS to deploy the services. In this way, you need to upload files, install software, create file directories, and assign file permissions again.

Service migration is not required but data on the data disk needs to be migrated.

Services need to be deployed and configured on the new ECS, which consumes manpower, materials, and time.

Server Migration Service (SMS)

The SMS supports physical to virtual (P2V) and virtual to virtual (V2V) migrations, enabling you to migrate x86 physical servers or VMs in private or public clouds to HUAWEI CLOUD.

  • You only need to install and configure the migration Agent on the source server and create the migration task on SMS. SMS will complete the migration.
  • Services are not interrupted during the migration. Resumable data transfer is supported.

The ECS to be migrated must be able to access the public network.

Image Management Service (IMS)

Migrate an ECS from an on-premises IDC, private cloud, or other public clouds to HUAWEI CLOUD, or migrate an ECS between HUAWEI CLOUD accounts in different regions by importing private images, replicating images cross regions, and sharing images.

  • Only image files in VHD, VMDK, QCOW2, RAW, VHDX, QCOW, VDI, QED, ZVHD, or ZVHD2 format can be imported.
  • Mainstream OSs, such as SUSE, Oracle Linux, Red Hat, Ubuntu, openSUSE, CentOS, Debian, Fedora, and EulerOS are compatible.
  • You can create system disk images, data disk images, and full-ECS images that can be used to create identical ECSs for batch service deployment.

Local storage space is occupied and only image files no larger than 1 TB can be used.

Cross-Account, Cross-Region ECS Migration

To migrate an ECS to a different account in another region, use the ECS to create an image, replicate the image to the destination region under the same account, and then share the image with the desired account.

For example, if a website is set up on an ECS in the CN North-Beijing4 region and you want to migrate the ECS to another account in the CN East-Shanghai1 region, the process is as follows:

Figure 1 Migration process
  1. Create a private image
  2. Replicate the image to the destination region
  3. Share the image with the desired account
  4. Accept the shared image
  5. Use the shared image to create an ECS

Step 1: Create a Private Image

Use the ECS with the website deployed to create an image in the CN North-Beijing4 region. Assume that the web access address of the ECS is http://121.36.xxx.xxx/index.html.

  1. Log in to the management console and switch to the CN North-Beijing4 region.
  2. Under Service List, choose Computing > Elastic Cloud Server.

    The Elastic Cloud Server page is displayed.

  3. Locate the row that contains the ECS with the website deployed (for example, ecs-373896-centos), and choose More > Manage Image/Disk > Create Image in the Operation column.

    The Create Image page is displayed.

  4. Set parameters.
    Figure 2 Creating a private image
    • Type: Select System disk image.
    • Source: Select ECS and select ecs-373896-centos from the list.
    • Name: Enter a name for the image, for example, migrate_test.
    • Enterprise Project: Select default.
  5. Click Next.
  6. Confirm the settings, read and agree to the agreement, and click Submit.
  7. The system redirects to the private image list. Wait for several minutes and check whether the private image is successfully created.
    Figure 3 Viewing private images

Step 2: Replicate the Image to the Destination Region

Replicate the private image created in Step 1: Create a Private Image to the CN East-Shanghai1 region. Before performing the replication, create an IAM agency.

  1. Create an IAM agency.
    1. In the upper right corner of the page, click the username and select Identity and Access Management.
    2. In the navigation pane, choose Agencies.
    3. Click Create Agency.
    4. On the Create Agency page, set the following parameters:
      • Agency Name: Enter an agency name, for example, ims_administrator_agency.
        Figure 4 Creating an agency
      • Agency Type: Select Cloud service.
      • Cloud Service: This parameter is available if you select Cloud service for Agency Type. Click Select. In the displayed Select Cloud Service dialog box, select Image Management Service (IMS) and click OK.
      • Validity Period: Select Unlimited.
      • Description: This parameter is optional. You can enter Agency with IMS Administrator privileges.
      • Permissions: Click Assign Permissions. By default, Policy View is displayed. Enter IMS Administrator in the search box, select the IMS Administrator check box, select CN North-Beijing4 and CN East-Shanghai1 in the Project [Region] column, and click OK.

        Do not select All projects in the Project [Region] column. Otherwise, the created agency will be invalid.

        Figure 5 Configuring permissions
    5. Click OK.
      Figure 6 Viewing agencies
  2. Under Service List, choose Computing > Image Management Service. Then, click the Private Images tab.

    The Private Images page is displayed.

  3. Locate the row that contains the migrate_test image, anc choose More > Replicate in the Operation.

    The Replicate Image dialog box is displayed.

  4. Set parameters.
    Figure 7 Replicating an image
    • Name: Retain the default value copy_cn-north-4_migrate_test.
    • Destination Region: Select CN East-Shanghai1.
    • Destination Project: Select cn-east-3.
    • IAM Agency: Select ims_administrator_agency created in 1.
  5. Click OK.
  6. Switch to the CN East-Shanghai1 region. Wait for several minutes and check whether the image is successfully replicated.
    Figure 8 Viewing private images

Step 3: Share the Image with the Desired Account

In the CN East-Shanghai1 region, share the image with the desired account. Before the image sharing, obtain the desired account name. If it is an account of a DeC or multi-project user, you also need to obtain its project name. (You can obtain the project name from My Credentials. For details, see Figure 9.)

Figure 9 Obtaining the account name and project name
  1. In the CN East-Shanghai1 region, choose Service List > Computing > Image Management Service and click the Private Images tab.

    The Private Images page is displayed.

  2. Locate the row that contains the copy_cn-north-4_migrate_test private image. Choose More > Share in the Operation column.

    The Share Image dialog box is displayed.

  3. Click the Shared Images tab, enter the desired account name, and click Add.
    Figure 10 Sharing an image
  4. Click OK.

Step 4: Accept the Shared Image

Accept the shared image in the CN East-Shanghai1 region.

  1. Log in to the management console using the account the image is shared with and switch to the CN East-Shanghai1 region.
  2. Under Service List, choose Computing > Image Management Service. Then, click the Images Shared with Me tab.
  3. In the displayed dialog box, select copy_cn-north-4_migrate_test and click Accept.
    Figure 11 Accepting a shared image

    After the image is accepted, it is displayed in the shared image list.

    Figure 12 Viewing shared images

Step 5: Use the Shared Image to Create an ECS

Use the shared image to create an ECS and verify that the website is available on the ECS.

  1. Locate the row that contains the shared image copy_cn-north-4_migrate_test, and click Apply for Server in the Operation column.

    The page for purchasing ECSs is displayed.

  2. Set the billing mode, AZ, specifications, and network as needed to create an ECS. Retain the default value for Image.
    Figure 13 Selecting an image
  3. Wait for several minutes and check whether the new ECS is displayed in the ECS list.
    Figure 14 Viewing ECSs
  4. Access the website to check whether the website is available on the new ECS.
    In the address box of the browser, enter http://ECS EIP/index.html, for example, http://124.70.xxx.xxx/index.html. If the website can be normally accessed, the migration is successful. No further action is required.
    Figure 15 Verifying the website