Help Center> Elastic Cloud Server> Best Practices> Migrating ECSs Across Accounts and Regions Through Image Replication
Updated on 2023-11-13 GMT+08:00

Migrating ECSs Across Accounts and Regions Through Image Replication

Scenarios

If you want to migrate ECSs between Huawei Cloud accounts in different regions, you are advised to use IMS to implement the migration.

For details about common scenarios and methods of server migration, see Migration Knowledge.

For details about migrating ECSs across accounts and regions, see Cross-Account, Cross-Region ECS Migration.

Migration Knowledge

Common server migration scenarios include migration from physical servers to cloud servers, from virtualization platforms, such as VMware, to Huawei Cloud ECSs, between Huawei Cloud ECSs across accounts or regions, from cloud servers on a third-party cloud platform to Huawei Cloud ECSs, and installation disk imaging. For details about the recommended migration methods, see Table 1.

Table 1 Common server migration scenarios

Scenario

Condition

Recommended Solution

Remarks

From x86 physical servers to Huawei Cloud ECSs

For example, P2V

The servers can access the Internet.

Server Migration Service

See Migrating Servers to the Cloud.

-

From virtualization platforms, such as VMware, to Huawei Cloud ECSs

The VMs can access the Internet.

Server Migration Service

See Migrating Servers to the Cloud.

-

The ECSs cannot access the Internet.

  1. Export the VM image files from the virtualization platform.
  2. Import the image files by referring to Uploading an External Image File.

If the image file format is not vhd, vmdk, qcow2, raw, vhdx, qcow, vdi, qed, zvhd, or zvhd2, convert the file format.

Between Huawei Cloud ECSs across accounts or regions

For example, the ECSs of account A in the CN North-Beijing4 region are to be migrated to account B in the CN East-Shanghai1 region.

The ECSs can access the Internet.

Server Migration Service

See Migrating Servers to the Cloud.

-

The ECSs cannot access the Internet.

Recommended

  • Migration across accounts: See Sharing Images.

    Use the system disk of the source ECS to create a system disk image and the data disk to create a data disk image, or use the source ECS to create a full-ECS image. Then, share the images with other accounts.

  • Migration between different regions: See Replicating Images Across Regions.

    Use the system disk of the source ECS to create a system disk image and the data disk to create a data disk image, or use the source ECS to create a full-ECS image. Then, replicate the images to other regions.

  • Migration between different accounts and regions: See Sharing Images and Replicating Images Across Regions.

Only the full-ECS images created using CBR can be shared.

The size of images to be replicated across regions cannot be greater than 128 GB.

From a third-party cloud platform to Huawei Cloud

For example, from Alibaba Cloud or Tencent Cloud to Huawei Cloud

The ECSs can access the Internet.

Server Migration Service

See Migrating Servers to the Cloud.

-

The ECSs cannot access the Internet.

  1. Export the image from the source cloud platform.
  2. Import the image files by referring to Uploading an External Image File.

If the image file format is not vhd, vmdk, qcow2, raw, vhdx, qcow, vdi, qed, zvhd, or zvhd2, convert the file format.

Installation disk imaging

For example, create an image file offline and import it to Huawei Cloud.

The ISO installation disk image of the required OS is available.

Creating a Windows Image Using VirtualBox and an ISO File Introduction

or

Creating a Windows System Disk Image from an ISO File

-

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 Compute > 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-fe9e), and choose More > Manage Image/Disk/Backup > Create Image in the Operation column.

    The Create Image page is displayed.

  4. Set parameters.
    Figure 2 Creating a private image
    • Type: Full-ECS image

      Data disks contain service data. You can use an ECS with data disks attached to it to create a full-ECS image.

    • Source: Select ECS and select ecs-fe9e from the list.
    • Specify Server Backup Vault to store backups. If the ECS has been associated with a vault, the system selects the associated vault by default.

      The created full-ECS image and backup are stored in the server backup vault.

      If no server backup vault is available, click Create Server Backup Vault to create one. Ensure that you select Backup for Protection Type.

    • 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.
    5. Click Next and select a policy for the agency.
    6. Select IMS Administrator.
      Figure 5 Selecting a policy
    7. Click Next and select an authorized region.
    8. In the Project [Region] column, select cn-north-4 [CN North-Beijing4] and cn-east-3 [CN East-Shanghai1], and click OK.
      Figure 6 Selecting a region

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

    9. Click Finish. You can view the created agency on the Basic Information tab.
      Figure 7 Viewing agencies
  2. Under Service List, choose Compute > 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 8 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.
    • Target Server Backup Vault: Select vault-2398.
    • 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 9 Viewing private images

Step 3: Share the Image with the Desired Account

In the CN East-Shanghai1 region, share the image with account B. Obtain the project ID of account B in the CN East-Shanghai1 region on the API Credentials page.

Figure 10 Obtaining the project ID
  1. In the CN East-Shanghai1 region, choose Service List > Compute > 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 project ID of account B, and click OK.
    Figure 11 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 Compute > 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 12 Accepting a shared image

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

    Figure 13 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 14 Selecting an image
  3. Wait for several minutes and check whether the new ECS is displayed in the ECS list.
  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