All Products
Search
Document Center

Elastic Compute Service:Use a shared image to create an ECS instance or replace an operating system, or copy a shared image

Last Updated:Nov 04, 2024

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 shared images to create Elastic Compute Service (ECS) instances and replace the operating systems of ECS instances and how to copy shared images.

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 items in the following table.

Item

Description

Fees

  • Images that are shared with an account do not count against the 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.

    Important

    If the encryption key of a shared encrypted image is invalid, ECS instances that were created from the image and snapshots and images that were created based on the disks of the ECS instances may be unavailable. When you copy a shared encrypted image that is shared with you or use the image to create an ECS instance or replace the operating system of an ECS instance, you must specify an encryption key for the new image (image copy) or the system disk of the ECS instance.

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 the Custom policy that grants a RAM user the permissions to create pay-as-you-go ECS instances section of the "Custom policies for ECS" topic.

  • If you want a RAM user to create ECS instances from a custom image that is shared only by a specific Alibaba Cloud account, you must attach a fine-grained permissions policy to the RAM user. Sample content of the policy:

    Policy content

    {
      "Version": "1",
      "Statement": [
        {
          "Action": [
            "ecs:RunInstances",
            "ecs:CreateInstance"
          ],
          "Effect": "Deny",
          "Resource": "acs:ecs:<Region ID>:*:image/*",
          "Condition": {
            "StringNotEquals": {
              "ecs:ImageOwnerId": "123456789012****"
            }
          }
        }
      ]
    }
    Note

    Replace ImageOwnerId with the ID of an Alibaba Cloud account based on your business requirements. This way, only custom images shared by the "123456789012****" account can be used to create ECS instances.

Use a shared image to create ECS instances

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

  1. Log on to the ECS console.

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

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

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

  5. 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 other parameters, see Create an instance on the Custom Launch tab.

Copy a shared image

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. Log on to the ECS console.

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

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

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

  5. In the Copy Image dialog box, configure parameters.

    • Set Copy Mode to Copy or Copy and Encrypt.

    • Select the region in which the shared image resides as the destination region.

      Note

      Shared images can be copied only to the region in which they reside. If you want to use 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 required region.

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

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

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

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

When you replace the operating system of the instance by using a shared image on the Change Operating System page, select Shared Image in the Image section and then select the shared image from the drop-down list. For more information, see Replace the operating system (system disk) of an instance.