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
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 |
For more information about image billing, see Images. |
Limits |
|
Permissions |
|
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.
Go to ECS console - Images.
In the top navigation bar, select the region and resource group of the resource that you want to manage.
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.
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.
Call an API operation
Call the DescribeImages operation to query the
IDs
of available shared images.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.ImportantIf 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
Call the DescribeImages operation to query the
IDs
of available shared images.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.ImportantIf 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.
On the Shared Images tab, find the shared image that you want to copy and click Copy Image in the Actions column.
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.
NoteShared 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.
(Optional) View the image copy on the Custom Images tab.
Call an API operation
Call the DescribeImages operation to query the
IDs
of available shared images.Call the CopyImage operation with
ImageId
set to the ID of an available shared image to copy the shared image.ImportantIf 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.