You can call this operation to manage the share permission of an image. After you share a custom image with another Alibaba Cloud account, the account can use the shared image to create ECS instances (RunInstances) or replace the system disk of an ECS instance (ReplaceSystemDisk).

Description

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

  • You can share only your own custom images to other Alibaba Cloud accounts.
  • A single request can contain a maximum of 10 accounts to which you share a custom image. You can specify a maximum of 10 values for the AddAccount.n or RemoveAccount.n parameter at a time. If you specify more than 10 values, the parameter will be ignored.
  • One image can be shared to a maximum of 50 Alibaba Cloud accounts. You can submit a ticket to share the image to more accounts.
  • If an instance is created (RunInstances) with a shared image, after the image owner stops sharing or deletes the custom image (DeleteImage), the created instance cannot be re-initialized (ReInitDisk).

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

Parameter Type Required Example Description
ImageId String Yes m-imageid1

The ID of the custom image to be shared.

RegionId String Yes cn-hangzhou

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

Action String Yes ModifyImageSharePermission

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

AddAccount.N RepeatList No 155780923***

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

RemoveAccount.N RepeatList No 155780923***

The IDs of the Alibaba Cloud account N to which the image is no longer to be shared. Valid values of N: 1 to 10. If the value of N is greater than 10, this parameter will be ignored.

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-imageid1
&RegionId=cn-hangzhou
&AddAccount.1=155780923***
&RemoveAccount.1=155780923***
&<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

HTTP status code 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 in the 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 trying 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 one 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.

For a list of error codes, visit the API Error Center.