Manages the share permissions on a custom image. You can share your custom images to other Alibaba Cloud accounts or publish the images as community images.

Description

When you call this operation, take note of the following items:

  • You can share only your own custom images with other Alibaba Cloud accounts.
  • You can share a custom image with up to 10 Alibaba Cloud accounts at a time. You can specify up to 10 Alibaba Cloud account IDs in the AddAccount.N or RemoveAccount.N parameter. If you specify more than 10 account IDs, the parameter will be ignored.
  • You can share a custom image with up to 50 Alibaba Cloud accounts.
  • If an instance was created (RunInstances) from a shared image, the instance cannot be re-initialized (ReInitDisk) after the image owner unshares or deletes the image (DeleteImage).

To publish or unpublish a community image, take note of the following items:

  • Alibaba Cloud provides only the platform where the community images can be published and managed. The owner of a community image is responsible for the quality and updates of the image. Make sure that you understand and accept the Community Image Agreement. Otherwise, you are not allowed to publish community images. For more information, see Publish a community image.
  • Encrypted images cannot be published as community images.
  • All community images are publicly available. All Alibaba Cloud accounts residing in the same region as image can access the image.
  • Community images cannot be shared, exported, or copied.
  • After a community image is unpublished, it is no longer available to other Alibaba Cloud accounts. If a custom image is shared to other Alibaba cloud accounts before it is published as a community image, the accounts with the shared image can still use the image after it is unpublished.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesModifyImageSharePermission

The operation that you want to perform. Set the value to ModifyImageSharePermission.

RegionIdStringYescn-hangzhou

The region ID of the custom image. You can call the DescribeRegions operation to query the most recent list of regions.

ImageIdStringYesm-bp18ygjuqnwhechc****

The ID of the custom image.

LaunchPermissionStringNohide
Note This parameter is currently in invitational preview and unavailable for general users.
AddAccount.NStringNo1234567890

The ID of Alibaba Cloud account N to which to share the custom image. Valid values of N: 1 to 10. If the value of N is greater than 10, this parameter is ignored.

RemoveAccount.NStringNo1234567890

The ID of Alibaba Cloud account N from which to unshare the custom image. Valid values of N: 1 to 10. If the value of N is greater than 10, this parameter is ignored.

IsPublicBooleanNofalse

Specifies whether to publish or unpublish the custom image as a community image. Valid values:

  • true: publishes the image as a community image.
  • false: unpublishes the image as a community image. If the image is not a community image before the operation, it remains unchanged.

Default value: false.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyImageSharePermission
&ImageId=m-bp18ygjuqnwhechc****
&RegionId=cn-hangzhou
&AddAccount.1=1234567890
&RemoveAccount.1=1234567890
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyImageSharePermissionResponse>
    <RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
</ModifyImageSharePermissionResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "C8B26B44-0189-443E-9816-D951F59623A9"
}

Error codes

HttpCodeError codeError messageDescription
400InvalidGroup.MalformedThe specified Group is wrongly formed.The error message returned because the specified group does not exist.
403QuotaExceed.ShareImageThe shared Image Quota exceeds.The error message returned because the maximum number of custom images that can be shared has been reached.
403QuotaExceed.ShareImageUserThe shared Image user Quota exceeds.The error message returned because the maximum number of accounts to which a single image can be shared is exceeded.
403InvalidImageId.BidMismatchCannot share image with other bid user.The error message returned because images cannot be shared among users of different carriers.
403OperationDeined.EncryptedSnapshotThe image contains encrypted snapshots, which do not support share.The error message returned because the specified image contains encrypted snapshots and cannot be shared.
404InvalidImageId.NotFoundThe specified ImageId does not exist.The error message returned because the specified image does not exist within this account. Check whether the image ID is correct.
404InvalidAccount.ForbbidenThe specified Account does not yourself.The error message returned because you are attempting to share the image to your own account.

For a list of error codes, see Service error codes.