Create a custom image from an instance

更新时间:
复制 MD 格式

Create a custom image from a pre-configured instance to batch-launch new instances with identical software and settings.

How it works

The system snapshots each cloud disk attached to the source instance, including the system disk and data disks. These snapshots form the custom image. When you create instances from this image, the system restores cloud disk data from the snapshots to replicate the source environment.

custom_image

Limitations

Instances of the local SSD (i-series) instance family are not supported.

Procedure

Prepare the instance

Clean and inspect the source instance before creating the image to ensure it is secure and reusable.

  1. Clean sensitive data: Remove personal files, passwords, private keys, and access credentials from the instance to prevent security risks.

  2. Reserve system disk space: Ensure sufficient free space on the system disk.

  3. (Conditional) Check system settings: For Linux instances, verify the following:

    • System logon and partition settings: Do not modify the default logon username (root) or the system disk partitions. Only a single root partition is supported.

    • System sensitive file configuration: Verify that /etc/fstab accurately reflects the data disks attached to the instance.

    • Critical system files: Do not modify /sbin, /bin, or /lib. Modifications can cause system errors.

  4. (Optional) Stop the instance: For data consistency, stop the instance before creating the image.

Create the custom image

Console

  1. Go to the ECS console - Instances page. Select the resource group and region of the source instance.

  2. Click the source instance ID. Choose All Operations > Create Custom Image.

  3. Enter an image name, configure optional parameters, and click OK.

    Important

    Do not stop, start, or restart the instance during image creation. These actions can cause the creation to fail.

    Check After Creation is selected by default. The system automatically runs Image Check after the image is created to verify that the image can create functional ECS instances.
    If you enable the image family feature, you can set the image status to Deprecated or Available to manage updates and rollbacks.
  4. Go to the ECS console - Images page. On the Custom Images tab, find the new image by name. The image is ready when its status changes to Available.

    Image creation time depends on the cloud disk size. The image becomes usable after all disk snapshots are created.

API

Call CreateImage with the InstanceId of the source instance. The system creates a snapshot for each cloud disk of the instance.

Next steps

  1. If you selected Check After Creation, view check details in the Check Result column. To fix issues, use the ACS-ECS-RepairImage template in CloudOps Orchestration Service (OOS) for one-click repair, or fix them manually.

  2. After creating a custom image, you can:

Billing

These snapshots incur storage fees based on their total size and the snapshot billing rules.

The System Disk Size column in the image list is for reference only. Actual billable capacity is shown in your billing statement.

Storage fees for a custom image (its associated snapshots) are independent of the source instance's billing method. Charges accrue as long as the custom image and its snapshots remain, even after the source instance is released.

If a custom image is created from a paid image, an image license fee applies when you use the custom image to create new instances.

FAQ

Why do RAM users get permission errors?

A RAM user needs the ecs:CreateImage permission, along with permissions to create snapshots and query instance resources. If the RAM policy enforces tag requirements on new resources, you must add a tag to the custom image during creation. Otherwise, the operation fails.

Why can't I delete an image's snapshot?

Snapshots referenced by an image cannot be deleted directly. Delete the custom image first, then delete the snapshot.

How to create an image from multiple instances?

Create a custom image from snapshots. This method lets you combine a system disk snapshot and data disk snapshots from different instances into a single custom image.