All Products
Search
Document Center

Elastic Compute Service:ModifyImageSharePermission

Last Updated:Dec 16, 2024

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.

Operation description

Usage notes

Take note of the following items:

  • You can share only your own custom images to other Alibaba Cloud accounts.
  • You can share a custom image to up to 10 Alibaba Cloud accounts at a time. You can specify up to 10 Alibaba Cloud account IDs by using AddAccount.N or RemoveAccount.N. If you specify more than 10 account IDs, the system processes only the first 10 account IDs. The excess account IDs are ignored.
  • You can share a custom image to up to 50 Alibaba Cloud accounts.
  • If an Elastic Compute Service (ECS) instance was created ( RunInstances ) from a shared image, you cannot re-initialize the instance ( ReInitDisk ) after the image owner unshares or deletes the image ( DeleteImage ).

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

  • Alibaba Cloud provides only the platform on which 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 acknowledge and agree to the Community Image Agreement. Otherwise, you cannot publish community images. For more information, see Publish a community image.
  • You cannot publish encrypted images as community images.
  • Community images are publicly available. A community image is available to all Alibaba Cloud accounts in the region where the image resides.
  • You cannot share, export, or copy community images.
  • After you unpublish a community image, the image is no longer available to other Alibaba Cloud accounts. If an image is shared to other Alibaba Cloud accounts before it is unpublished, the image remains available to the accounts.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ModifyImageSharePermissionupdate
*Image
acs:ecs:{#regionId}:{#accountId}:image/{#imageId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ImageIdstringYes

The ID of the custom image.

m-bp18ygjuqnwhechc****
LaunchPermissionstringNo
Note This parameter is in invitational preview and is not publicly available.
hide
AddAccountarrayNo

The ID of Alibaba Cloud account N to which you want to share the custom image. Valid values of N: 1 to 10. If you specify more than 10 Alibaba Cloud account IDs, the system processes only the first 10 account IDs. The excess account IDs are ignored.

stringNo

The ID of Alibaba Cloud account N to which you want to share the custom image. Valid values of N: 1 to 10. If you specify more than 10 Alibaba Cloud account IDs, the system processes only the first 10 account IDs. The excess account IDs are ignored.

1234567890
RemoveAccountarrayNo

The ID of Alibaba Cloud account N from which you want to unshare the custom image. Valid values of N: 1 to 10. If you specify more than 10 Alibaba Cloud account IDs, the system processes only the first 10 account IDs. The excess account IDs are ignored.

stringNo

The ID of Alibaba Cloud account N from which you want to unshare the custom image. Valid values of N: 1 to 10. If you specify more than 10 Alibaba Cloud account IDs, the system processes only the first 10 account IDs. The excess account IDs are ignored.

1234567890
IsPublicbooleanNo

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

  • true: publishes the custom image as a community image.
  • false: unpublishes a community image. The unpublish operation takes effect only on community images.

Default value: false.

false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameterThe input parameter "RegionId" that is mandatory for processing this request is not supplied.-
400InvalidGroup.MalformedThe specified Group is wrongly formed.-
400UnnecessaryParameter.LaunchPermissionThe specified parameter "LaunchPermission" is unnecessary if paramter "AddAccounts" or "RemoveAccounts" exist.-
400InvalidParameter.LaunchPermissionThe specified parameter "LaunchPermission" is invalid.-
400ForbiddenParameter.LaunchPermissionThe specified parameter "LaunchPermission" is forbidden for current account.-
403AssumeRoleErrorRequires a RAM role of AliyunECSShareEncryptImageDefaultRole before sharing encrypted image.Before you share encrypted images, make sure that the AliyunECSShareEncryptImageDefaultRole RAM role is attached to your account.
403ImageDescription.ContainsSensitiveWordsThe specified image description contains sensitive words.-
403ImageName.ContainsSensitiveWordsThe specified image name contains sensitive words.-
403Image.PublicThe specified image is public image.-
403CurrentRegion.NotSupportPublicImagePublic image is not supported for current region.-
403Image.NotPublicThe specified image is not public image.The specified image is not published as a community image and cannot be unpublished.
403OperationDeined.FullImageThe encrypted image contains multiple snapshots, which do not support share.-
403QuotaExceed.ShareImageThe shared Image Quota exceeds.The maximum number of custom images that can be shared has been reached.
403QuotaExceed.ShareImageUserThe shared Image user Quota exceeds.The maximum number of accounts to which a single image can be shared is exceeded.
403InvalidImageId.BidMismatchCannot share image with other bid user.The image cannot be shared among users of different carriers.
403OperationDeined.EncryptedSnapshotThe image contains encrypted snapshots, which do not support share.The specified image contains encrypted snapshots and cannot be shared.
403OperationDenied.InvalidImageStatusThe specified image cannot be shared when it is deprecated.-
403PublicImageAgreement.NotSignedThe current account has not signed "Community Image Terms of Service".You have not signed the Community Image Terms of Service.
403InvalidParameter.IsPublicThe specified parameter IsPublic is conflicted with other parameters.The specified parameter IsPublic conflict with another parameter.
404InvalidImageId.NotFoundThe specified ImageId does not exist.The specified image does not exist in this account. Check whether the image ID is correct.
404InvalidAccount.NotFoundThe specified parameter "AddAccount.n" or "RemoveAccount.n" does not exist.-
404InvalidAccount.ForbbidenThe specified Account does not yourself.You are attempting to share the image to your own account.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-11The Error code has changedView Change Details
2023-04-19The Error code has changedView Change Details
2023-04-10The Error code has changedView Change Details
2021-06-23The Error code has changedView Change Details