All Products
Search
Document Center

Elastic Compute Service:Use a custom image to migrate ECS instance data

Last Updated:Mar 07, 2024

Elastic Compute Service (ECS) instances are continuously iterated. During the iteration, issues may occur on earlier ECS instances, such as failures in provisioning new resources. This may affect the O&M of your services on the cloud. The custom image feature helps you migrate data from a source ECS instance to a new destination ECS instance. This helps ensure the O&M efficiency of your services on the cloud. This topic describes how to use a custom image to migrate ECS instance data across regions.

Usage notes

Before you migrate instance data, take note of the following items:

  • When you create a custom image, the system automatically creates a snapshot for each disk of the ECS instance. You are charged for the snapshots. For more information about the billing rules of snapshots, see Snapshots.

  • Snapshots cannot be created for some instances that use on-premises storage. The procedure described in this topic cannot be used to migrate data to or from such ECS instances.

  • Source ECS instances can be located in the classic network or virtual private clouds (VPCs).

  • Destination ECS instances can be created only in VPCs.

  • Only instance types available within the selected zone can be used to create destination ECS instances.

    Note

    If you want to migrate instance data across zones or regions, we recommend that you plan resources in the source and destination zones or regions in advance.

  • After you use the custom image feature to migrate instance data, disk data on the destination ECS instance is the same as that on the source ECS instance, but new metadata is generated for the destination ECS instance and is different from that of the source ECS instance. For more information about instance metadata, see Overview of ECS instance metadata.

    Before you migrate instance data, we recommend that you manually sort out resource associations so that you can update resource associations accordingly at the earliest opportunity after migration. Examples:

    • If instances use private IP addresses to communicate within a cluster, you must replace the private IP address of the source instance with the private IP address of the destination instance after you migrate data from one instance to another within the cluster. This way, the destination instance can communicate with other instances instead of the source instance.

    • The licenses of some applications are bound to the media access control (MAC) addresses of instances. After you migrate data from one instance to another, the licenses bound to the MAC address of the source instance become invalid, and you must rebind the licenses to the MAC address of the destination instance.

Step 1: Create a custom image from the source ECS instance

Before you create a custom image from the source ECS instance, make sure that you understand the precautions of creating a custom image. For more information, see Create a custom image from an instance.

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the upper-left corner of the top navigation bar, select a region. In this example, select China (Hangzhou).

  4. Find the source ECS instance and choose image.png > Disk and Image > Create Custom Image in the Actions column.

  5. In the Create Custom Image dialog box, configure parameters and click OK.

    Specify the Custom Image Name parameter. In this example, set the parameter to Created_from_hangzhouECS1. For more information about other parameters, see Create a custom image from an instance.

  6. In the left-side navigation pane, choose Instances & Images > Images.

  7. On the Custom Image tab, find the Created_from_hangzhouECS1 custom image that you created in the previous step and check its status.

    When the custom image is in the Available state, you can proceed to the next step.

Step 2: Copy the custom image to a different region

If you want to migrate data from the source ECS instance to a destination ECS instance that is located in a different region, you must first use the image copy feature to copy the custom image that you created in Step 1 to the required region.

  1. In the left-side navigation pane, choose Instances & Images > Images.

  2. In the upper-left corner of the top navigation bar, select a region. In this example, select China (Hangzhou).

  3. On the Custom Image tab, find the Created_from_hangzhouECS1 image and click Copy Image in the Actions column.

  4. In the Copy Image dialog box, configure the parameters and click OK.

    • Enter a name for the copied image. Example: Copy_from_hangzhouImage1.

    • Select a destination region. Example: China (Beijing).

    • For more information about other parameters, see Copy a custom image.

  5. In the upper-left corner of the top navigation bar, switch to the China (Beijing) region to check the progress and status of the Copy_from_hangzhouImage1 image.

    After the custom image is copied to the destination region, you must perform the subsequent steps in the region.

Step 3: Create a destination ECS instance from the custom image

  1. In the left-side navigation pane, choose Instances & Images > Images.

  2. In the upper-left corner of the top navigation bar, select a region. In this example, select China (Beijing).

  3. On the Custom Image tab, find the copied custom image Copy_from_hangzhouImage1.

  4. In the Actions column, click Create Instance.

  5. On the ECS instance buy page, configure the parameters to create an ECS instance to use as the destination ECS instance.

    • The parameters in the Image and Region sections are automatically specified and do not need to be modified.

    • Select an instance type based on your business requirements.

    • Set Logon Credentials to Inherit Password From Image.

      Note

      Then, you can use the same password to log on to the created destination ECS instance and the source ECS instance.

    • For more information about other parameters, see Create an instance on the Custom Launch tab.

Step 4: Check data in the destination ECS instance

You must check the data in the destination instance to ensure that services can continue to run smoothly on the destination instance after migration. Examples:

  • Check disk data: Remotely connect to the new destination ECS instance and check whether the system disk data is the same as the system disk data of the source ECS instance. For example, check whether the files and the directory structures match. If the source ECS instance has a data disk and the corresponding disk is attached to the destination ECS instance, you can check whether the data on the attached disk is the same as that of the source ECS instance.

  • Run applications or services: If a specific application or service runs on your source ECS instance, you can run the application or service on the destination ECS instance. Then, check whether the application or service can provide features and support data operations in the same manner as those on the source ECS instance.

  • Compare resource information to understand changes: You can view instance information and compare resource information to understand the changes between the source ECS instance and the destination ECS instance. The information includes image information and network configurations. For more information, see View instance information.

  • Update resource associations: The instance metadata of the newly created destination instance is regenerated and changes compared with the instance metadata in the source instance. You must update resource associations at the earliest opportunity after data migration. For more information, see Obtain instance metadata.

Step 5: Release or delete the source ECS instance and its resources

After you perform the following operations, you can release or delete the source ECS instance and its resources to avoid unnecessary costs: Verify that data on the destination ECS instance is the same as that on the source ECS instance, update resource associations for the destination ECS instance, and make sure that services can continue to run smoothly on the destination ECS instance.

Warning

The instance release, snapshot deletion, and image deletion operations are irreversible. When an ECS instance is released or after a snapshot or image is deleted, data in the ECS instance, snapshot, or image is deleted and cannot be recovered. Make sure that you release or delete resources only after all business data is migrated.

  • For information about how to release an instance, see Release an instance.

  • For more information about how to delete a snapshot, see Delete a snapshot.

  • For more information about how to delete a custom image, see Delete a custom image.

    Important

    After a custom image is deleted, ECS instances that use the image cannot have their system disks initialized. If your custom image is free of charge and is required in subsequent operations, we recommend that you do not delete it. For more information about the billing rules of images, see Images.

References

You can use Server Migration Center (SMC) to migrate ECS instances in the same region or across regions. For more information, see Migrate servers between ECS instances.