Create a custom image from a source instance and copy it to another region to deploy an identical environment.
Usage notes
Before you replicate an ECS instance across regions, note the following items:
-
Creating a custom image from an instance automatically creates a snapshot for each attached disk. You are charged for the snapshots. See Snapshot billing.
NoteSnapshots cannot be created for local disks. Instances with local disks do not support the operations described in this topic.
-
The source instance must reside in a Virtual Private Cloud (VPC), and the new instance must also reside in a VPC.
-
The new instance has the same disk data as the source instance but receives new instance metadata, including a new instance ID, public IP address, and private IP address. Identify resource associations before replication so you can update them promptly after replication. See Obtain instance metadata.
Step 1: Create a custom image from the source ECS instance
Go to ECS console - Instances.
-
In the upper-left corner of the top navigation bar, select a region.
-
Find the source instance and click the instance ID to go to the details page. In the upper-right corner, click All Actions. Search for and click Create Custom Image.
-
In the Create Custom Image dialog box, configure parameters and click Confirm.
-
Specify the custom image name.
-
For other parameters, see Create a custom image from an instance.
-
Go to ECS console - Images.
-
On the Custom Images tab, find the custom image you created and check its status.
When the image is in the Available state, proceed to the next step.
Step 2: Copy the custom image to a different region
Copy the custom image you created to the destination region before creating a new instance there.
Go to ECS console - Images.
-
In the upper-left corner of the top navigation bar, select a region.
-
On the Custom Images tab, find the custom image and click Copy Image in the Actions column.
-
In the Copy Image dialog box, configure the parameters and click Confirm.
-
Enter a name for the image copy.
-
Select a destination region.
-
For other parameters, see Copy a custom image.
-
-
Switch to the destination region to check the image copy progress and status.
After the image is copied, perform the subsequent steps in the destination region.
Step 3: Create a new ECS instance from the custom image
Go to ECS console - Images.
-
In the upper-left corner of the top navigation bar, select a region.
-
On the Custom Images tab, find the custom image copy.
-
In the Actions column, click Create Instance.
-
On the instance buy page, configure the parameters to create an instance.
-
The Image and Region parameters are auto-filled. No modification is needed.
-
Select an instance type based on your business requirements.
-
For other parameters, see Create an instance with Custom Launch.
-
Step 4: Check the data in the new ECS instance
Verify that business runs as expected on the new instance. Examples:
-
Check the disk data.
Verify that the system disk data (files, directory structures) on the new instance matches the source instance. If data disks are attached, verify data disk consistency as well.
-
Run applications or services.
Run the same applications or services on the new instance and verify that they provide the same functionality and data operations as on the source instance.
-
Compare resource information.
Compare resource information, such as image information and network configurations, between the source and new instances. See View instance information.
-
Update resource associations.
The new instance receives new metadata that differs from the source instance. Update resource associations promptly after replication. Examples:
-
If an application depends on a specific private IP address for internal communication, update the network configurations of the new instance after replication. For example, change the private IP address to one in the same subnet as the source instance and verify network connectivity. See Modify the private IP address of an instance.
-
If an application depends on DNS services, update the DNS settings of the new instance after replication to ensure continued external service. See How do I customize the DNS settings of a Linux instance?
-
(Optional) Step 5: Release or delete the source ECS instance and the resources of the instance
Instance release, snapshot deletion, and image deletion are irreversible. Data in the released instance, deleted snapshot, or deleted image cannot be recovered. Release or delete resources only after all business data is migrated.
Before releasing the source instance and its resources, verify data consistency on the new instance, update resource associations, and confirm that business runs as expected.
References
To migrate ECS instance data across Alibaba Cloud accounts, use Server Migration Center (SMC). See Migrating ECS instances: cross-account and same-account.