All Products
Search
Document Center

Elastic Compute Service:Use shared images

Last Updated:May 06, 2025

You can share your custom images with other Alibaba Cloud accounts (sharees). The shared custom images are considered as shared images. Then, the sharees can use the shared images. This topic describes how to use a shared image to create Elastic Compute Service (ECS) instances and replace the operating system of an ECS instance and how to copy a shared image.

Considerations

Important

Alibaba Cloud does not guarantee the integrity and security of shared images. Before you use shared images, make sure that the images come from trusted accounts. You must assume all risks associated with using shared images.

Before you use a shared image, take note of the following items.

Item

Description

Fees

  • Images that are shared with an Alibaba Cloud account do not count against the custom image quota of the account. The account is not charged for the shared images.

  • If a shared image is derived from a paid image and the sharees use the shared image to create ECS instances, the sharees are charged for the shared image. For example, if another Alibaba Cloud account shares a paid image with you, and you use the shared image to create an ECS instance, you are charged for the shared image and the created instance.

For more information about image billing, see Images.

Limits

  • Sharees cannot perform operations on shared images but can use shared images to create ECS instances. Sharees must copy shared images to their accounts as custom images before they can delete or update the images.

  • If the resources that are used by a shared image are unavailable due to overdue payments or invalid keys, the shared image cannot be used to create ECS instances.

Permissions

  • If you want to use a Resource Access Management (RAM) user to create ECS instances from a shared image, the RAM user must have permissions to call the RunInstances or CreateInstance operation. For more information, see Custom policy that grants a RAM user the permissions to create pay-as-you-go ECS instances.

  • If you want a RAM user to create ECS instances from an image that is shared only by a specific Alibaba Cloud account, you must attach the following permissions policy to the RAM user:

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "ecs:RunInstances",
            "ecs:CreateInstance"
          ],
          "Effect": "Deny",
          "Resource": "*",
          "Condition": {
            "StringNotEquals": {
              "ecs:ImageOwnerId": "123456789012****"
            }
          }
        }
      ]
    }
    Note

    Replace the value of the ImageOwnerId parameter with the ID of an Alibaba Cloud account. In the preceding example, the value of the parameter is "123456789012****", which indicates that only custom images shared by the "123456789012****" account can be used to create ECS instances.

Use a shared image to create ECS instances

Use the ECS console

You can use a shared image to create one or more ECS instances that have the same image environment.

  1. Go to ECS console - Images.

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

  3. Click the Shared Images tab, find the shared image that you want to use to create ECS instances, and then click Create Instance in the Actions column.

    image

  4. The region and the image are automatically populated. Configure other parameters, such as Billing Method and Instance Type, based on your business requirements.

    For information about how to configure other parameters, see Create an instance on the Custom Launch tab.

    If you use an encrypted shared image to create ECS instances, the system disks or data disks that are created from the image for the ECS instances are automatically encrypted and cannot be changed to unencrypted. You must specify the service key or a customer master key (CMK) as the encryption key for the system disks or data disks.

    image

Call an API operation

  1. Call the DescribeImages operation to query the IDs of available shared images.

  2. Call the RunInstances or CreateInstance operation with ImageId set to the ID of an available shared image to create ECS instances from the shared image.

    Important

    If the specified shared image is an encrypted image, you must set Encrypted to true. Otherwise, the ECS instances may fail to be created.

Use a shared image to replace the operating system (system disk) of an ECS instance

Use the ECS console

You can use a shared image to replace the operating system (system disk) of an ECS instance. Then, the instance runs based on the shared image.

In the Image section of the Change Operating System page, select Shared Image and then select a shared image. For more information, see Replace the operating system (system disk) of an instance.

Call an API operation

  1. Call the DescribeImages operation to query the IDs of available shared images.

  2. Call the ReplaceSystemDisk operation with ImageId set to the ID of an available shared image to replace the operating system (system disk) of an ECS instance by using the shared image.

    Important

    If the specified shared image is an encrypted image, you must set Encrypted to true to encrypt the new system disk by using your own key. Otherwise, the operating system of the ECS instance may fail to be replaced.

Copy a shared image

Use the ECS console

When you are a sharee, you can use a shared image only to create ECS instances. If you want to delete or update a shared image, copy the shared image and then delete or update the copy of the shared image. The copy is displayed as a custom image in the custom image list within the same region.

  1. On the Shared Images tab, find the shared image that you want to copy and click Copy Image in the Actions column.

    image

  2. In the Copy Image dialog box, configure the parameters as prompted.

    • Set Copy Mode to Copy or Copy and Encrypt.

    • For Destination Region, you can select only the region in which the shared image resides.

      Note

      Shared images can be copied only to the region in which they reside. If you want to copy a shared image to a different region, you must make a copy of the shared image in the region in which the image resides and then copy the image copy to the other region.

    For information about how to configure other parameters, see Copy a custom image.

  3. (Optional) View the image copy on the Custom Images tab.

Call an API operation

  1. Call the DescribeImages operation to query the IDs of available shared images.

  2. Call the CopyImage operation with ImageId set to the ID of an available shared image to copy the shared image.

    Important

    If the specified shared image is an encrypted image, you must set Encrypted to true to encrypt the image copy by using your own key. Otherwise, the shared image may fail to be copied.

References

  • You can use shared images to deploy ECS instances across multiple Alibaba Cloud accounts in the same region. For more information, see Share a custom image.

  • If you no longer want to share custom images with other Alibaba Cloud accounts, you can unshare the images. For more information, see Unshare images.

  • For information about the permissions required to share encrypted images, see Encryption-related permissions.