If your current 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 region or across regions.
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 an image to ECS.
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 console, create an ECS instance based on the shared image. This way, data is migrated 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 across regions
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 ECS instance to the server, 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 must 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.
Configuration of the simple application server | Configuration of the ECS instance |
|
|
Procedure
You can migrate data from a simple application server to an ECS instance in the same region or across regions based on your migration scenarios.
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 custom images.
Parameter description:
Name: the name of the custom image that you manually set to identify the image. Example:
LNMP-to-Ecs
.Description: the description of the custom image that you manually set to record information about the image. Example: 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 how to share custom images, see Share an image to ECS.
On the Image page, find custom image
LNMP-to-Ecs
and click Share to ECS in the Actions column.In the message that appears, click Confirm.
After the image is shared, Share to ECS is automatically changed to Unshare the image to ECS in the Actions column of custom image
LNMP-to-Ecs
on the Image page.
Create an ECS instance based on the shared image.
On the Image page, find custom image
LNMP-to-Ecs
and click Create ECS in the Actions column.You are redirected to the ECS instance buy page.
On the Custom Launch tab of the ECS instance buy page, configure parameters to create an instance based on the shared image.
In this example, the following configurations are used:
Region and Zone: Use the default region. By default, the region where the
LNMP-to-Ecs
custom image resides is used. The zone is randomly selected.Instance Type: In this example, the ecs.c6.large instance type of the Compute-optimized category is used.
Image: Use the default settings. The value is the ID of the shared image 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 in the inbound rules of the security group. In this example, you must select a security group that allows traffic on ports 22, 80, 443, 3306, and 8080.
Instance Name: Specify a name for the ECS instance. In this example, the name is
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 on the Custom Launch tab.
After you create the ECS instance, go to the ECS console. In the left-side navigation pane, choose
. On the Instances page, you can find thetest-Ecs-LNMP
instance that you created.
Test the 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 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.
This 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 across regions
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 custom images.
Parameter description:
Name: the name of the custom image that you manually set to identify the image. Example:
LNMP-to-Ecs
.Description: the description of the custom image that you manually set to record information about the image. Example: 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 Image page, find custom image
LNMP-shared-Ecs
and click Copy Image in the Actions column.In the Copy Image dialog box, configure parameters based on your business requirements and click Confirm.
The following table describes the parameters.
Parameter
Description
Destination Region
Select a destination region to which you want to copy the custom image. Example: China (Beijing).
Name of the custom image
Enter a name for the copy of the custom image for identification. Example:
test-copy-image
.Description
Enter a description for the copy of the custom image. The default description contains the ID and source region of the custom image. You can modify the description.
After you confirm the copy operation, you can view that the custom image in the destination region is in the Copying state on the Image page. You must wait for the custom image to be copied.
NoteAfter the custom image is copied, the Server ID/Name column of the custom image in the destination region is empty.
Share the custom image with ECS.
Perform the following operations. For more information about sharing custom images, see Share an image to ECS.
On the Image page, find custom image
test-copy-image
and click Share to ECS in the Actions column.In the message that appears, click Confirm.
After the custom image is shared, Share to ECS is automatically changed to Unshare the image to ECS in the Actions column of custom image
test-copy-image
on the Image page.
Create an ECS instance based on the shared image.
Click Create ECS Instance in the Actions column of custom image
test-copy-image
.You are redirected to the ECS instance buy page.
On the Custom Launch tab of the ECS instance buy page, configure parameters to create an instance based on the shared image.
In this example, the following configurations are used:
Parameter
Description
Region and Zone
Use the default settings. In this example, the default region is China (Beijing), and the default zone is randomly selected.
Instance Type
In this example, ecs.c6.large of the Compute-optimized instance family is used.
Image
Use the default settings. The
test-copy-image
custom image is automatically filled out.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 in the inbound rules of the security group. In this example, you must select a security group that allows traffic on ports 22, 80, 443, 3306, and 8080.
Instance Name
Specify a name for the ECS instance. Example:
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 on the Custom Launch tab.
After you create the ECS instance, go to the ECS console. In the left-side navigation pane, choose
. On the Instances page, you can find thetest-Ecs-LNMP
instance that you created.
Test the 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 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.
This 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 that you can use to access the data changes. If you configured a domain name for the source simple application server, you must also configure a domain name for the destination ECS instance after the migration. For more information, see Add DNS records.