All Products
Search
Document Center

Elastic Compute Service:Clone an instance

Last Updated:Jun 19, 2025

The Elastic Compute Service (ECS) instance cloning feature helps you quickly duplicate instances. It can be used in scenarios, such as environment testing and replication, application extensions, disaster recovery, backup, migration, and upgrade, and helps improve service reliability, scalability, and efficiency. This topic describes how to clone instances and their billing method and limits.

Note

To migrate the data of Instance A to Instance B, perform the following steps:

  1. Create a custom image from Instance A.

  2. (Conditionally optional) Copy the custom image.

    If Instances A and B are in different regions, copy the custom image to Instance B's region.

  3. Replace Instance B's operating system by using the image copy.

Comparison between the source and clone instances

Instance attribute

Difference

Instance name

The name of the clone instance is same as that of the source instance.

Instance type

The instance type of the clone instance may differ from that of the source instance.

If the instance type of the source instance is out of stock in the destination zone, the system selects a similar instance type to create the clone instance.

Private IP address

The private IP address of the clone instance may differ from that of the source instance.

  • If you do not specify a vSwitch for the clone instance, the system creates a vSwitch based on the source instance's vSwitch configuration and assigns a private IP address from the CIDR block of the created vSwitch to the clone instance.

  • If you specify a vSwitch for the clone instance, the system assigns a private IP address from the CIDR block of the specified vSwitch to the clone instance.

Public IP address

The public IP address of the clone instance may differ from that of the source instance.

Public IP addresses are automatically assigned and unique.

Note

If an elastic IP address (EIP) is associated with the source instance, the system does not automatically create and associate an EIP with the clone instance. You can create and associate an EIP with the clone instance as needed.

Security groups

The security groups of the clone instance may differ from those of the source instance, but their security group rules are the same.

  • If you specify the source instance's virtual private cloud (VPC) for the clone instance, the clone instance inherits the source instance's security groups.

  • If you specify a different VPC or region for the clone instance, the system clones one security group of the source instance for the clone instance.

Prerequisites

Billing methods

  • The clone instance's billing method is the same as that of the source instance.

  • If you select Contain Instance Data when cloning an instance, a custom image whose name starts with TemplateScratch- is generated. For information about the billing of custom images, see Images.

    Type

    Contain Instance Data

    Description

    In-region cloning

    Contain Instance Data selected

    The system creates a custom image from the source instance and then creates the clone instance from the image.

    Contain Instance Data not selected

    The system creates the clone instance from the source instance's image.

    Cross-region cloning

    Contain Instance Data selected

    The system creates a custom image from the source instance, copies the custom image to the destination region, and then creates the clone instance from the image copy.

    Contain Instance Data not selected

    The system creates the clone instance from the source instance's image.

    Note

    The source instance's image must be a public or Marketplace image in the destination region.

Important
  • If the source instance does not have an image, select Contain Instance Data.

  • You are charged for the custom image and the image copy. If you no longer require them, delete them in the source or destination region after cloning.

Limits

  • Only ECS instances in VPCs support the instance cloning feature.

  • You can clone up to 20 ECS instances in a cloning task.

  • You can only clone instances in the ECS console. No API operation is available for this feature.

Procedure

  1. Go to ECS console - Instance.

  2. In the top navigation bar, select the region and resource group of the resource that you want to manage. 地域

  3. Click the target Instance ID to go to the instance details page. Click All Actions in the upper-right corner to expand the action panel, and then search for and click Clone Instance.

  4. In the Clone Instance dialog box, configure parameters and then click Next.

    Parameter

    Description

    Destination Region

    Select the region where you want to create the clone instance.

    Destination Zone

    Select the zone where you want to create the clone instance.

    Destination VPC

    • If you do not specify a destination vSwitch, the system creates a vSwitch based on the source instance's vSwitch configuration and assigns a private IP address to the clone instance.

    • If you specify a destination vSwitch, the system assigns a private IP address to the clone instance under that vSwitch.

    • If you do not specify a vSwitch or VPC when you clone the source instance across regions, the system creates a VPC based on the source instance's VPC and selects a zone to create a vSwitch based on the source instance's vSwitch.

    • If you specify a different destination VPC or region from those of the source instance, the system creates security groups for the clone instance in the specified VPC or region based on the source instance's security groups. If you specify the source instance's VPC or region as the destination VPC or region, the system uses the source instance's security groups for the clone instance.

    Destination vSwitch

    Destination Instance Quantity

    Configure the number of clone instances you want to create.

    You can create up to 100 clone instances at a time. If the number of clone instances you want to create exceeds the maximum number of additional instances you can create, the number of clone instances created is equal to the maximum number of additional instances you can create.

    Contain Instance Data

    • If you do not select Contain Instance Data, the system creates a clone instance with the same instance type as the source instance.

    • If you select Contain Instance Data, the system creates a clone instance with the same instance type and data as the source instance. We recommend that you stop the source instance before cloning to ensure data consistency.

    Important

    If the source instance's instance type is out of stock, the system selects a similar instance type to create the clone instance.

  5. In the Configuration Preview step, confirm the clone instance's basic information and click Start.

    Note

    The first time you clone an instance, read ECS Terms of Service and select I have read and agreed to ECS Terms of Service.

    The cloning feature is implemented by Resource Orchestration Service (ROS). You can log on to the ROS console to view the cloning progress. After cloning, the related stack is automatically deleted, but the created resources, including the VPC, vSwitch, security groups, custom image, and instance, are retained.

  6. View the cloning results.

    In the Clone Result step, the cloning task is completed when the following message is displayed: The instance is cloned. You can log on to the instances and check whether the clone instance's data is consistent with that of the source instance.