You can call this operation to manage the share permission on a custom image. You can share your custom images to other Alibaba Cloud accounts or publish the images as community images.
Description
To manage shared images, take note of the following items:
- You can share only your own custom images to other Alibaba Cloud accounts.
- A custom image can be shared to a maximum of 10 Alibaba Cloud accounts at a time.
You can specify up to 10 Alibaba Cloud account IDs in the
AddAccount.n
orRemoveAccount.n
parameter. If you specify more than 10 account IDs, the parameter is ignored. - A single custom image can be shared to a maximum of 50 Alibaba Cloud accounts. You can submit a ticket to share a custom image to more 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:
- The owner of a community image is responsible for the quality and updates of the image. Alibaba Clouds provides only the platform where the community images can be published and managed. Make sure that you are aware of the content of the Community Image Agreement and have signed the agreement. Otherwise, you are not allowed to publish community images. For more information, see Unpublish a community image.
- Encrypted images cannot be published as community images.
- Community images are completely available. A community image is available to all Alibaba Cloud accounts in the region where the image is located.
- Community images cannot be shared, exported, or copied.
- After a community image is unpublished, it is not 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 image is still shared to the accounts after it is unpublished.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyImageSharePermission |
The operation that you want to perform. Set the value to ModifyImageSharePermission. |
ImageId | String | Yes | m-bp18ygjuqnwhechc**** |
The ID of the custom image. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the custom image. You can call the DescribeRegions operation to query the most recent region list. |
AddAccount.N | RepeatList | No | 1234567890 |
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.N | RepeatList | No | 1234567890 |
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. |
IsPublic | Boolean | No | false |
Specifies whether to publish the specified custom image as a community image. Valid values:
Note If the parameter value is set to
true , other optional parameters are not allowed to be specified.
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-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
<ModifyImageSharePermissionResponse>
<RequestId>C8B26B44-0189-443E-9816-D951F59623A9</RequestId>
</ModifyImageSharePermissionResponse>
JSON
format
{
"RequestId": "C8B26B44-0189-443E-9816-D951F59623A9"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | MissingParameter | The input parameter "RegionId" that is mandatory for processing this request is not supplied. | The error message returned because the required RegionId parameter is not specified. |
404 | InvalidImageId.NotFound | The 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. |
404 | InvalidAccount.NotFound | The specified parameter "AddAccount.n" or "RemoveAccount.n" does not exist. | The error message returned because the specified AddAccount.N or RemoveAccount.N parameter does not exist. |
404 | InvalidAccount.Forbbiden | The specified Account does not yourself. | The error message returned because you are attempting to share the image to your own account. |
403 | QuotaExceed.ShareImage | The shared Image Quota exceeds. | The error message returned because the maximum number of custom images that can be shared has been reached. |
403 | QuotaExceed.ShareImageUser | The shared Image user Quota exceeds. | The error message returned because the maximum number of Alibaba Cloud accounts to which a single image can be shared has been reached. |
400 | InvalidGroup.Malformed | The specified Group is wrongly formed. | The error message returned because the specified group does not exist. |
403 | InvalidImageId.BidMismatch | Cannot share image with other bid user. | The error message returned because images cannot be shared among users of different carriers. |
403 | OperationDeined.EncryptedSnapshot | The image contains encrypted snapshots, which do not support share. | The error message returned because the specified image contains encrypted snapshots and cannot be shared. |
400 | PublicImageAgreement.NotSigned | Current account not sign public image agreement. | The error message returned because the current you have not signed the community image agreement. Therefore, the specified image cannot be published as a community image. You can call the ModifyUserBusinessBehavior operation to sign the community image agreement. |
400 | ImageIsPrivate | The specified image is private. | The error message returned because the specified image is already in the private state. |
400 | ImageIsPublic | The specified image is public. | The error message returned because the specified image is already in public state. |
400 | EncryptedImage.NotSupportPublic | Encrypted image is not supported to be public. | The error message returned because the specified image is an encrypted image and cannot be published as a community image. |
400 | InvalidImageStatus.NotAvailable | Public image status must be available. | The error message returned because the specified image is not in the Available state. |
For a list of error codes, visit the API Error Center.