You can use the custom image feature of Simple Application Server to migrate data from a simple application server to an Elastic Compute Service (ECS) instance. This topic describes how to use the custom image feature to migrate data from a simple application server to an ECS instance.

Prerequisites

  • The simple application server whose data you want to migrate is in the Running state. If the server is expired, you must renew the server first. For more information, see Renew a server.
  • You understand the custom image feature of Simple Application Server. For more information, see Overview.

Background information

This topic provides examples for the following migration scenarios: The following section describes the server configurations and the migration results:
  • Server configurations
    Note This topic describes only the configurations for the examples in the topic. In actual practice, configure the resources based on your requirements for data migration. For example, if the firewall of your simple application server allows traffic over ports 80, 443, 22, 8080, and 3306, the security group to which your ECS instance belongs must also allow inbound traffic over ports 80, 443, 22, 8080, and 3306.
    Configuration of the simple application server Configuration of the ECS instance
    • Region: China (Beijing).
    • Image: application image LNMP 7.4.
    • Firewall: Traffic are allowed over ports 80, 443, and 22.
    • Example configuration of the server: The test web page file test.html is saved in the default folder named default under the website root directory /data/wwwroot.
    • Region:
      • Data migration in the same region: China (Beijing)
      • Data migration across regions: China (Hangzhou)
    • Instance type: For scenarios in which you want to deploy web applications, we recommend that you use compute-optimized instance types, such as ecs.c6.large.
    • Image: the custom image of the simple application server that is shared with ECS.
    • Network: a virtual private cloud (VPC) that is assigned a public IP address.
    • Security group: allows inbound traffic over ports 80, 443, and 22.
  • Migration results
    Note This topic provides the migration results of the examples. In actual practice, you can log on to the ECS instance after data is migrated to check whether the data on the ECS instance is the same as the data in the source simple application server.
    The following figure shows the result that you use a browser to access a test web page file deployed in the simple application server. After data is migrated from the simple application server to the ECS instance, you can also use a browser to access the web page from <The public IP address of the ECS instance>/test.html. Test file

Impacts

Before you migrate data, take note of the following items:
  • Hardware-locked application licenses may become invalid.

    The simple application server and the ECS instance reside in different VPCs. Therefore, after data is migrated from the simple application server to the ECS instance, the underlying hardware may change, and hardware-locked application licenses may become invalid. You are responsible for checking whether your application license is hardware-locked.

  • The public IP address changes when data is migrated from the simple application server to the ECS instance.

    The public IP address of the ECS instance is different from that of the simple application server. If a domain name is associated with your simple application server, you must resolve the domain name to the public IP address of the ECS instance after you migrate data from the simple application server to the ECS instance.

  • The management of custom images or shared images may have impacts on the simple application server.
    • After you share a custom image of the simple application sever with ECS and create an ECS instance from the shared image, if you unshare the image in the Simple Application Server console, you cannot query the shared image by using the ECS console or calling an ECS API, nor use the shared image. The system disks of the ECS instances that were created from the shared image cannot be re-initialized. If you want to continue to use the shared image in ECS, we recommend that you copy the shared image before you unshare it.
    • If you want to delete the custom image of the simple application sever that has been shared with ECS, you must unshare the image first. After the custom image is deleted, the simple application servers that were created from the custom image cannot be reset.

Migrate data from a simple application server to an ECS instance in the same region

  1. Log on to the Simple Application Server console.
  2. In the left-side navigation pane, click Servers.
  3. Click the card of the simple application server whose data you want to migrate to go to the server details page.
  4. Create a snapshot.
    Perform the following operations. For more information about the snapshot feature, see Manage snapshots.
    1. In the left-side navigation pane, choose Server Maintenance > Disk.
    2. In the System Disk section, click Create Snapshot.
      If your simple application server has a data disk attached, and you want to migrate the data both on the system disk and the data disk to the ECS instance, you must separately create snapshots for the system disk and the data disk.
    3. In the left-side navigation pane, choose Server Maintenance > Snapshots.
      On the Snapshots page, you can view the snapshots that you created for the system disk and the data disk. If the snapshot is being created, wait until the snapshot is created.
  5. Create a custom image.
    Perform the following operations. For more information about the custom image feature, see Create a custom image.
    1. On the Snapshots page, view the system disk snapshot and click Create a custom image in the Operation column.
    2. In the Create a custom image dialog box, configure the parameters and click OK.
      Make the following configurations:
      • Custom image name: the name of the custom image that you manually set to identify the image. Example name used in this topic: LNMP-shared-Ecs.
      • Custom image description: the description of the custom image that you manually set to record information about the image. Example description in this topic: Test to share an image with ECS.
      • Data disk snapshot: If your simple application server has a data disk attached and you want to migrate the data on both the system disk and the data disk of the simple application server to the ECS instance, select the data disk snapshot. If your simple application server does not have a data disk attached, or you do not want to migrate the data on the data disk, do not select the data disk snapshot.
    3. After the custom image is created, click Go to view.
      You can view the information about the custom image that you created on the Mirror List page.
  6. Share the custom image with ECS.
    1. On the Mirror List page, find the LNMP-shared-Ecs custom image and click Share to ECS in the Operation column.
    2. In the message that appears, click OK.
      After you share the custom image with ECS, on the Mirror List page, Share to ECS in the Operation column of LNMP-shared-Ecs is automatically changed into Cancel sharing to ECS.
  7. Create an ECS instance.
    1. On the Mirror List page, find the LNMP-shared-Ecs custom image. Click Create ECS in the Operation column of the image.
    2. On the Custom Launch tab of the ECS instance buy page, configure the parameters to create an instance.
      In this example, the following configurations are used:
      • Region: Retain the default configuration. By default, the region is configured as the region where the LNMP-shared-Ecs custom image resides. The zone is configured as Random by default.
      • Instance Type: In this example, for the Category parameter, select Compute Optimized. Then, select ecs.c6.large.
      • Image: Retain the default configuration. This field is automatically completed. The value is the ID of the shared image generated after the LNMP-shared-Ecs custom image is shared with ECS.
      • Public IP Address: Select Assign Public IPv4 Address.
      • Security Group: Select an existing security group or create a security group. Make sure that the security group allows inbound traffic over the ports required by the ECS instance. In this example, a security group that allows inbound traffic over ports 22, 80, and 443 must be selected.
      • Instance Name: Specify a name for your ECS instance. In this example, specify the name as test-Ecs-LNMP
      You can configure other parameters based on your requirements. For more information, see Create an instance by using the wizard.
      After you create the ECS instance, go to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances. On the Instances page, you can find the test-Ecs-LNMP instance that you created.
  8. Test the access to the website in the ECS instance.
    1. On the Instances page, view the information of the test-Ecs-LNMP instance.
    2. In the IP Address column, obtain the public IP address of the ECS instance.
      You must make sure that the instance is in the Running state. Otherwise, you will not be able to test the access to the website deployed in the ECS instance. Public IP address
    3. Use a browser to access <The public IP address of the ECS instance>/test.html.
      When you access the public IP address of the ECS instance, the following page is shown. You can find the test website deployed in the test-Ecs-LNMP instance can be accessed, and the content is the same as the content of the test website deployed in the source simple application server. Test website deployed in the ECS instanceThis indicates that the data in the simple application server is migrated to the ECS instance.

Migrate data from a simple application server to an ECS instance in a different region

  1. Log on to the Simple Application Server console.
  2. In the left-side navigation pane, click Servers.
  3. Click the card of the simple application server whose data you want to migrate to go to the server details page.
  4. Create a snapshot.
    Perform the following operations. For more information about the snapshot feature, see Manage snapshots.
    1. In the left-side navigation pane, choose Server Maintenance > Disk.
    2. In the System Disk section, click Create Snapshot.
      If your simple application server has a data disk attached, and you want to migrate the data both on the system disk and the data disk to the ECS instance, you must separately create snapshots for the system disk and the data disk.
    3. In the left-side navigation pane, choose Server Maintenance > Snapshots.
      On the Snapshots page, you can view the snapshots that you created for the system disk and the data disk. If the snapshot is being created, wait until the snapshot is created.
  5. Create a custom image.
    Perform the following operations. For more information about the custom image feature, see Create a custom image.
    1. On the Snapshots page, view the system disk snapshot and click Create a custom image in the Operation column.
    2. In the Create a custom image dialog box, configure the parameters and click OK.
      Make the following configurations:
      • Custom image name: the name of the custom image that you manually set to identify the image. Example name used in this topic: LNMP-shared-Ecs.
      • Custom image description: the description of the custom image that you manually set to record information about the image. Example description in this topic: Test to share an image with ECS.
      • Data disk snapshot: If your simple application server has a data disk attached and you want to migrate the data on both the system disk and the data disk of the simple application server to the ECS instance, select the data disk snapshot. If your simple application server does not have a data disk attached, or you do not want to migrate the data on the data disk, do not select the data disk snapshot.
    3. After the custom image is created, click Go to view.
      You can view the information about the custom image that you created on the Mirror List page.
  6. Share the custom image with ECS.
    1. On the Mirror List page, find the LNMP-shared-Ecs custom image and click Share to ECS in the Operation column.
    2. In the message that appears, click OK.
      After you share the custom image with ECS, on the Mirror List page, Share to ECS in the Operation column of LNMP-shared-Ecs is automatically changed into Cancel sharing to ECS.
  7. Copy the shared image to the destination region.
    In this example, the simple application server is deployed in China (Beijing), and the destination ECS instance is deployed in China (Hangzhou).
    1. On the Mirror List page, find the LNMP-shared-Ecs custom image. Click Create ECS in the Operation column of the image.
    2. View the ID of the shared image in the Image section on the ECS instance buy page.
      This field is automatically completed. The value is the ID of the shared image generated after the LNMP-shared-Ecs custom image is shared with ECS. Record the ID of the shared image on the ECS instance buy page. You can use this ID to search for the shared image in the next step. You do not need to create an ECS instance.
    3. Log on to the ECS console.
    4. In the left-side navigation pane, choose Instances & Images > Images.
    5. In the top navigation bar, select China (Beijing) for the region.
    6. On the Images page, click the Shared Image tab and enter the ID of the shared image in the search box to search for the shared image. Search for the shared image
    7. Copy the shared image to the China (Hangzhou) region.
      Shared images cannot be directly copied across regions. To generate a copy of a shared image across regions, you must use the image copy feature to generate a custom image in the source region, and then copy the custom image from the source region to the destination region. You can perform the following operations:
      1. Click Copy Image in the Actions column of the shared image.
      2. In the Copy Image dialog box, configure the parameters and click OK.
        In this example, the following configurations are used:
        • Destination Region: China (Beijing)
        • Custom Image Name: The example value in this topic is Test-beijing-hangzhou.
        Retain the default configurations for other parameters.
      3. On the Images page, click the Custom Image tab.
      4. In the Image Family section, click All Images.
      5. Enter Test-beijing-hangzhou in the search box to search for the custom image. Search for the generated custom image
      6. Find the Test-beijing-hangzhou custom image and click Copy Image in the Actions column.
      7. In the Copy Image dialog box, configure the parameters and click OK.
        In this example, the following configurations are used:
        • Destination Region: China (Hangzhou).
        • Custom Image Name: The example value in this topic is LNMP-Ecs-hangzhou.
        Retain the default configurations for other parameters.
      8. In the top navigation bar, select China (Hangzhou) for the region.
      9. On the Custom Image tab of the Images page, you can view the LNMP-Ecs-hangzhou custom image that you copied.

        You can also enter the image name LNMP-Ecs-hangzhou in the search box to find the custom image.

  8. Create an ECS instance.
    1. In the Actions column of the LNMP-Ecs-hangzhou custom image in the China (Hangzhou) region, click Create Instance.
    2. On the Custom Launch tab of the ECS instance buy page, configure the parameters to create an instance.
      In this example, the following configurations are used:
      • Region: Retain the default configuration. The default region on the current page is China (Hangzhou). The zone is configured as Random by default.
      • Instance Type: In this example, for the Category parameter, select Compute Optimized. Then, select ecs.c6.large.
      • Image: Retain the default configuration. This field is automatically completed. The value is the name of the LNMP-Ecs-hangzhou custom image.
      • Public IP Address: Select Assign Public IPv4 Address.
      • Security Group: Select an existing security group or create a security group. Make sure that the security group allows inbound traffic over the ports required by the ECS instance. In this example, a security group that allows inbound traffic over ports 22, 80, and 443 must be selected.
      • Instance Name: Specify a name for your ECS instance. In this example, specify the name as test-Ecs-LNMP
      You can configure other parameters based on your requirements. For more information, see Create an instance by using the wizard.
      After you create the ECS instance, go to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances. On the Instances page, you can find the test-Ecs-LNMP instance that you created.
  9. Test the access to the website in the ECS instance.
    1. On the Instances page, view the information of the test-Ecs-LNMP instance.
    2. In the IP Address column, obtain the public IP address of the ECS instance.
      You must make sure that the instance is in the Running state. Otherwise, you will not be able to test the access to the website deployed in the ECS instance. Public IP address
    3. Use a browser to access <The public IP address of the ECS instance>/test.html.
      When you access the public IP address of the ECS instance, the following page is shown. You can find the test website deployed in the test-Ecs-LNMP instance can be accessed, and the content is the same as the content of the test website deployed in the source simple application server. Test website deployed in the ECS instanceThis indicates that the data in the simple application server is migrated to the ECS instance.

What to do next

The public IP address changes because data is migrated from the simple application server to the ECS instance. If a domain name is associated with the source simple application server and is resolved, you must resolve the domain name to the public IP address of the ECS instance after data is migrated. For more information, see Add DNS records.