All Products
Search
Document Center

Elastic Compute Service:Create a custom image from an instance

Last Updated:Feb 21, 2024

After you create an Elastic Compute Service (ECS) instance, you can customize the instance by performing operations, such as installing software and deploying application environments, based on your business requirements and then create a custom image from the instance. Instances created from the custom image contain all of the customized items, which eliminates the need to configure these items for each new instance. This topic describes how to create a custom image from an existing instance.

Prerequisites

Background information

When you create a custom image from an instance, a snapshot is automatically created for each disk on the instance. All the snapshots together constitute a complete custom image, as shown in the following figure.

Note

If the instance has data disks, the custom image contains the snapshots of both the system disk and data disks of the instance.

custom_image

Considerations

Before you create a custom image from an instance, take note of the items that are described in the following table.

Item

Description

Region

A custom image resides in the same region as the instance from which the image was created. For information about how to use images across regions, see Copy an image.

Billing

  • A snapshot is automatically generated for each disk when you create a custom image. You are charged for the snapshots. For information about the billing of snapshots, see Snapshots.

  • Custom images are billed independently of the ECS instances that were used to create the images or created from the images. For example, custom images created from subscription instances can be used to create pay-as-you-go instances.

Instance type

You cannot create images that contain snapshots of system disks and data disks from instances that use local SSDs. For more information, see Instance families with local SSDs.

Instance status

  • When you create a custom image from an instance, you do not need to stop the instance.

    Note

    However, when you create a custom image from an instance that is in the Running state, real-time data may not be saved to the image. To ensure data integrity, we recommend that you stop the instance before you use it to create a custom image. If you do not want to stop your instance, you can create a snapshot-consistent group from the instance and then use the snapshot-consistent group to create a custom image. For more information, see Create a snapshot-consistent group.

  • When a custom image is being created from an instance, do not change the status of the instance. For example, if you stop, start, or restart an instance while a custom image is being created from the instance, the image cannot be created.

  • You cannot create images from expired subscription instances. You can create snapshots for the system disks of the instances. For more information, see Create a custom image from a snapshot.

  • You cannot create images from released instances. If you retained system disk snapshots of the instances, you can create custom images from the snapshots. For more information, see Create a custom image from a snapshot.

Linux instance

When you create a custom image from a Linux instance, take note the following additional items:

  • Do not load data disk information to the /etc/fstab file. Otherwise, instances created from the image cannot be started.

  • Do not update the kernel or operating system version.

  • Do not adjust the system disk partitions. Only system disks with a single root partition are supported.

  • Do not modify critical system files, such as /sbin, /bin, and /lib.

  • Do not modify the logon username root.

Amount of time required to create an image

The amount of time that is required to create an image from an instance depends on the disk size of the instance. Wait until the snapshot for each disk is created before you can use the image.

Procedure

  1. Log on to the ECS console.

  2. In the left-side navigation pane, choose Instances & Images > Instances.

  3. In the top navigation bar, select the region and resource group to which the resource belongs. 地域

  4. Find the instance from which you want to create a custom image. Choose 更多 > Disk and Image > Create Custom Image in the Actions column.

  5. In the Create Custom Image dialog box, configure the parameters that are described in the following table.

    Parameter

    Description

    References

    Image Name

    Enter a name for the custom image.

    N/A

    Image Check

    Optional. The image check feature checks whether imported custom images are valid and whether the images can be used to create full-featured ECS instances.

    By default, Check After Creation is selected, and the image check feature checks the custom image immediately after the image is created. After the image is checked, you can find the image in the custom image list and click Details in the Status column to view the check results and resolve issues based on the solutions that are provided in the results. For information about check items and solutions to image issues, see Overview.

    Note

    Only specific operating systems support the image check feature. For information about the operating systems that do not support the image check feature, see Operating system limits for image check.

    Overview of image check

    Image Family

    Optional. Select an image family for the custom image. Custom images that belong to an image family can be deprecated or restored to allow smooth image updates and rollbacks.

    Overview of image families

    Image Description

    Optional. Enter a description for the custom image.

    N/A

    Tag

    Select one or more tags.

    • Tag is an optional parameter in most scenarios.

    • Tag is a required parameter when you log on as a Resource Access Management (RAM) user and a policy attached to the RAM user requires that tags be added. In this case, if you do not specify the Tag parameter, an error that indicates insufficient permissions is reported.

    Overview of tags

    Resource Group

    Optional. Select a resource group to manage the custom image based on usage and permissions.

    Resource groups

  6. Click OK.