All Products
Search
Document Center

Simple Application Server:Migrate data from a simple application server to an ECS instance by using a shared image

Last Updated:Dec 21, 2023

If your simple application server cannot meet your business requirements, you can smoothly migrate data from the simple application server to an Elastic Compute Service (ECS) instance to obtain more flexible resource configuration solutions. This topic describes how to migrate data from a simple application server to an ECS instance in the same or different region.

Prerequisites

Scenarios

The scenarios of migrating data from a simple application server to an ECS instance include:

  • Scenario 1: Migrate data from a simple application server to an ECS instance in the same region

    The following figure shows the migration process. asdasdDescription:

    1. Create a snapshot for the simple application server whose data you want to migrate.

    2. Create a custom image based on the snapshot.

    3. Share the custom image with an ECS instance in the same region.

    4. In the ECS control, create an ECS instance based on the shared image. This way, you migrate data from the simple application server to the ECS instance in the same region.

  • Scenario 2: Migrate data from a simple application server to an ECS instance in a different region

    The following figure shows the migration process. adasDescription:

    1. Create a snapshot for the simple application server whose data you want to migrate.

    2. Create Custom Image A based on the snapshot.

    3. Copy Custom Image A to the destination region to generate Custom Image B.

    4. Share Custom Image B with ECS. Finally, create an ECS instance based on the shared custom image.

Impacts of the migration

Item

Description

Authorized applications on the ECS instance and the simple application server

The ECS instance and the simple application server reside in different virtual private clouds (VPCs). After data is migrated from the server to the ECS instance, the underlying hardware may change, and hardware-locked application licenses may become invalid. You are responsible for maintaining the application licenses valid.

Public IP address

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

Sample configurations of the simple application server and the ECS instance

Note

This topic provides only sample configurations. In practice, you need to configure resources based on your business requirements. 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.

Configurations of the simple application server

Configurations of the ECS instance

  • Region: China (Hangzhou).

  • Image: application image LNMP 7.4.

  • Firewall: allows traffic over ports 80, 443, 22, 8080, and 3306.

  • Sample configurations of the server: The web page test file test.html is stored in the default folder named default in the website root directory /data/wwwroot. The content of the test file is Test-Ecs-001.

  • Region:

    • Migrate data in the same region: China (Hangzhou).

    • Migrate data to a different region: China (Beijing).

  • Instance type: We recommend that you use compute-optimized instance types such as ecs.c6.large to deploy the web application.

  • Image: a custom image of the simple application server that is shared with ECS.

  • Network: The ECS instance belongs to a virtual private cloud (VPC) and is assigned a public IP address.

  • Security group: allows inbound traffic over ports 80, 443, 22, 8080, and 3306.

Procedure

You can migrate data from a simple application server to an ECS instance in the same region or a different region based on your migration scenario.

Scenario 1: 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. Create a snapshot for the server. For more information, see Create a 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. Create a custom image based on the snapshot. For more information, see Create a custom image.

    Parameter description:

    • Custom Image Name: the name of the custom image that you manually set to identify the image. Example name used in this topic: LNMP-to-Ecs.

    • Custom Image Description: the description of the custom image that you manually set to record information about the image. Example description used in this topic: Test sharing 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 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.

  4. Share the custom image with ECS.

    Perform the following operations. For more information about sharing custom images, see Share a custom image.

    1. On the Images page, find the LNMP-to-Ecs custom image and click Share to ECS in the Actions column that corresponds to the custom image.

    2. In the message that appears, click OK.

      After you share the custom image with ECS, on the Images page, Share to ECS in the Actions column that corresponds to the LNMP-to-Ecs custom image automatically changes to Stop Sharing to ECS.

  5. Create an ECS instance based on the shared image.

    1. On the Images page, find the LNMP-to-Ecs custom image. Click Create ECS Instance in the Actions column that corresponds to the custom image.

      You are redirected to the ECS instance buy page.

    2. On the Custom Launch tab of the ECS instance buy page, configure the parameters to create an instance based on the shared image.

      In this example, the following configurations are used:

      • Region: Use the default settings. The region where the LNMP-to-Ecs custom image resides is automatically filled in this field. 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: Use the default settings. The default value is the ID of the shared image that is generated after the LNMP-to-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 ports required by the ECS instance are enabled for the security group. In this example, you must select a security group for which ports 22, 80, 443, 3306, and 8080 are enabled.

      • Instance Name: Enter a name for your ECS instance. Example instance name used in this topic: test-Ecs-LNMP.

      You can configure other parameters based on your business requirements. For more information about how to create an instance, see Create an instance by using the wizard.

      After you create the ECS instance, go back to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances. On the Instances page, you can view the test-Ecs-LNMP instance that you created.

  6. Test access to the website on 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 access to the website deployed on the ECS instance. 公网IP地址

    3. On your on-premises physical machine, use a browser to access http://<Public IP address of the ECS instance>/test.html.

      When you access the public IP address of the ECS instance, the following page is displayed. The test website deployed on the test-Ecs-LNMP instance can be accessed, and the website content is consistent with the content of the test website deployed on the source simple application server.

      Note

      This topic provides the migration results in the sample scenario. In actual practice, you can log on to the ECS instance after data is migrated and check whether the data on the ECS instance is consistent with the data on the source simple application server.

      ECS实例测试网站The test result indicates that the data on the simple application server is migrated to the ECS instance.

Scenario 2: 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. Create a snapshot for the server. For more information, see Create a 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. Create a custom image based on the snapshot. For more information, see Create a custom image.

    Parameter description:

    • Custom Image Name: the name of the custom image that you manually set to identify the image. Example name used in this topic: LNMP-to-Ecs.

    • Custom Image Description: the description of the custom image that you manually set to record information about the image. Example description used in this topic: Test sharing 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 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.

  4. Copy the custom image to the destination region.

    Perform the following operations. For more information about how to copy a custom image, see Copy a custom image.

    1. On the Images page, find the LNMP-shared-Ecs custom image. Click Copy Image in the Actions column that corresponds to the custom image.

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

      The following table describes the parameters.

      Parameter

      Description

      Destination Region

      Select a destination region to which you want to copy the source custom image. Example region used in this topic: China (Beijing).

      Custom Image Name

      Enter a name for the new custom image. Example name used in this topic: test-copy-image.

      Custom Image Description

      Enter a description for the new custom image. The default description contains the ID and region of the source custom image. You can modify the description.

      After you click OK in the Copy Image dialog box, you can view the information of the custom image in the Copying state on the Images page. Wait until the image copy task is complete.

      Note

      The Instance Name column for the new custom image is left empty.

  5. Share the new custom image with ECS.

    Perform the following operations. For more information about sharing custom images, see Share a custom image.

    1. On the Images page, find the test-copy-image custom image. Click Share to ECS in the Actions column that corresponds to the custom image.

    2. In the message that appears, click OK.

      After you share the custom image with ECS, on the Images page, Share to ECS in the Actions column that corresponds to the test-copy-image custom image automatically changes to Stop Sharing to ECS.

  6. Create an ECS instance based on the shared image.

    1. Click Create ECS Instance in the Actions column that corresponds to the test-copy-image custom image.

      You are redirected to the ECS instance buy page.

    2. On the Custom Launch tab of the ECS instance buy page, configure the parameters to create an instance based on the shared image.

      In this example, the following configurations are used:

      Parameter

      Description

      Region

      Use the default settings. In this example, the default region is China (Beijing), and the default zone is random.

      Instance Type

      In this example, for the Category parameter, select Compute Optimized. Then, select ecs.c6.large.

      Image

      Use the default settings. The test-copy-image custom image is automatically filled in.

      Public IP address

      Select Assign Public IPv4 Address.

      Security Group

      Select an existing security group or create a security group. Make sure that the ports required by the ECS instance are enabled for the security group. In this example, you must select a security group for which ports 22, 80, 443, 3306, and 8080 are enabled.

      Instance Name

      Enter a name for your ECS instance. Example instance name used in this topic: test-Ecs-LNMP.

      You can configure other parameters based on your business requirements. For more information about how to create an ECS instance, see Create an instance by using the wizard.

      After you create the ECS instance, go back to the ECS console. In the left-side navigation pane, choose Instances & Images > Instances. On the Instances page, you can view the test-Ecs-LNMP instance that you created.

  7. Test access to the website on 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 access to the website deployed on the ECS instance. 公网IP地址

    3. On your on-premises physical machine, use a browser to access http://<Public IP address of the ECS instance>/test.html.

      When you access the public IP address of the ECS instance, the following page is displayed. The test website deployed on the test-Ecs-LNMP instance can be accessed, and the website content is consistent with the content of the test website deployed on the source simple application server.

      Note

      This topic provides the migration results in the sample scenario. In actual practice, you can log on to the ECS instance after data is migrated and check whether the data on the ECS instance is consistent with the data on the source simple application server.

      ECS实例测试网站The test result indicates that the data on the simple application server is migrated to the ECS instance.

What to do next

After the data is migrated, the public IP address changes. 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 the data is migrated. For more information, see Add a DNS records.