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
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 Upgrade and renew a simple application server.
You understand the custom image and shared image features of Simple Application Server. For more information, see Overview of custom images and Share a custom image.
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. Description:
Create a snapshot for the simple application server whose data you want to migrate.
Create a custom image based on the snapshot.
Share the custom image with an ECS instance in the same region.
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. Description:
Create a snapshot for the simple application server whose data you want to migrate.
Create Custom Image A based on the snapshot.
Copy Custom Image A to the destination region to generate Custom Image B.
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
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 |
|
|
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
Log on to the Simple Application Server console.
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.
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.
Share the custom image with ECS.
Perform the following operations. For more information about sharing custom images, see Share a custom image.
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.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.
Create an ECS instance based on the shared image.
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.
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
. On the Instances page, you can view thetest-Ecs-LNMP
instance that you created.
Test access to the website on the ECS instance.
On the Instances page, view the information of the
test-Ecs-LNMP
instance.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.
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.NoteThis 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.
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
Log on to the Simple Application Server console.
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.
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.
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.
On the Images page, find the
LNMP-shared-Ecs
custom image. Click Copy Image in the Actions column that corresponds to the custom image.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.
NoteThe Instance Name column for the new custom image is left empty.
Share the new custom image with ECS.
Perform the following operations. For more information about sharing custom images, see Share a custom image.
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.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.
Create an ECS instance based on the shared image.
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.
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
. On the Instances page, you can view thetest-Ecs-LNMP
instance that you created.
Test access to the website on the ECS instance.
On the Instances page, view the information of the
test-Ecs-LNMP
instance.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.
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.NoteThis 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.
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.