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
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyImageSharePermission | The operation that you want to perform. Set the value to ModifyImageSharePermission. |
RegionId | String | Yes | cn-hangzhou | The region ID of the custom image. You can call the DescribeRegions operation to query the most recent list of regions. |
ImageId | String | Yes | m-bp18ygjuqnwhechc**** | The ID of the custom image. |
LaunchPermission | String | No | hide | Note This parameter is currently in invitational preview and unavailable for general users. |
AddAccount.N | String | 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 | String | 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 or unpublish the custom image as a community image. Valid values:
Default value: false. |
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
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
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | InvalidGroup.Malformed | The specified Group is wrongly formed. | The error message returned because the specified group does not exist. |
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 accounts to which a single image can be shared is exceeded. |
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. |
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.Forbbiden | The 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.