Help Center/ Image Management Service/ Best Practices/ Migrating ECSs Across Accounts and Regions
Updated on 2024-06-12 GMT+08:00

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 and across 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 labor, materials, and time.

Server Migration Service

You can use SMS to migrate x86 physical servers or VMs from private or public clouds to Huawei Cloud through physical to virtual (P2V) or virtual to virtual (V2V) migration.

  • You only need to install and configure an 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 server to be migrated must be able to access the Internet.

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 or across regions by importing private images, replicating images across 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 and to 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 target account. The target account accepts the shared image and uses the image to create a new ECS.

For example, if a website is set up on an ECS in the CN-Hong Kong region and you want to migrate the ECS to the CN East-Shanghai2 region under another account, 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 target 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-Hong Kong region. Assume that the ECS web address is http://121.36.xxx.xxx/index.html.

  1. Log in to the management console and switch to the CN-Hong Kong 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-373896-centos), and choose More > Manage Image > Create Image in the Operation column.

    The Create Image page is displayed.

  4. Set parameters.
    Figure 2 Creating a private image
    • Type: Select Create Image.
    • Image Type: Select System disk image.
    • Source: Select ECS and select then 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-Shanghai2 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_admin_agency.
        Figure 4 Creating an agency
      • Agency Type: Select Cloud service.
      • Cloud Service: This parameter is available only 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-Hong Kong and CN East-Shanghai2 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 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, and choose More > Replicate in the Operation.

    The Replicate Image dialog box is displayed.

  4. Set parameters.
    • Name: Retain the default value copy_ap-southeast-1 _migrate_test.
    • Destination Region: Select CN East-Shanghai2.
    • Destination Project: Select cn-east-2.
    • IAM Agency: Select ims_admin_agency created in 1.
  5. Click OK.
  6. Switch to the CN East-Shanghai2 region. Wait for several minutes and check whether the image is successfully replicated.
    Figure 7 Viewing private images

Step 3: Share the Image with the Target Account

Before the image sharing, obtain the project ID of the target account. (You can obtain the project ID from My Credentials. For details, see Figure 8.)

Figure 8 Viewing the project ID or account ID
  1. In the CN East-Shanghai2 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_ap-southeast-1_migrate_test private image. Choose More > Share in the Operation column.

    The Share Image dialog box is displayed.

  3. In the Share Image dialog box, enter the project ID of the target account.
  4. Click OK.

Step 4: Accept the Shared Image

Accept the shared image in the East-Shanghai2 region.

  1. Log in to the management console using the account the image is shared with and switch to the CN East-Shanghai2 region.
  2. Under Service List, choose Compute > Image Management Service. Then, click the Images Shared with Me tab.
  3. Select copy_ap-southeast-1_migrate_test and click Accept.
    After the image is accepted, it is displayed in the shared image list.
    Figure 9 Accepting a shared image

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_ap-southeast-1_migrate_test, and click Apply for Server in the Operation column.

    The page for purchasing ECSs is displayed.

  2. Configure the billing mode, AZ, specifications, and network as needed to create an ECS. Retain the default value for Image.
    Figure 10 Selecting an image
  3. Wait for several minutes and check whether the new ECS is displayed in the ECS list.
    Figure 11 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 12 Verifying the website