全部產品
Search
文件中心

Elastic Compute Service:ModifyImageSharePermission

更新時間:Sep 14, 2026

管理映像共享權限。您可以將自己的自訂映像共享給其他阿里雲帳號,也可以發布為社群映像供他人使用。

介面說明

呼叫該介面前,請您仔細閱讀共享自訂映像。

呼叫該介面時,請注意以下共享規則:

  • 共享限制:只能共享自己帳號下建立的自訂映像,每份映像最多可共享給 50 個阿里雲帳號,每份映像一次最多共享給 10 個阿里雲帳號。

  • 執行個體影響:使用共享映像建立 ECS 執行個體( RunInstances )後,一旦自訂映像擁有者解除了映像共享關係,或者刪除了自訂映像( DeleteImage ),該執行個體將無法初始化系統磁碟( ReInitDisk )。

重要 雲端伺服器 ECS 共享加密映像規則變更:僅支援共享使用使用者主金鑰 CMK 加密的映像,不再支援共享使用服務金鑰加密的映像,使用服務金鑰加密的映像在共享時將會報錯。如果您保有服務金鑰加密的映像且計畫共享給他人使用,請透過複製映像(CopyImage),將映像金鑰改為使用者主金鑰 CMK。

發布或下架社群映像,您需要注意:

  • 責任與協議:社群映像由其擁有者負責品質和迭代更新,阿里雲僅提供平台支援。發布前請確保您已了解並簽署社群映像協議,否則不允許發布,社群映像詳情見發布社群映像。

  • 加密限制:加密映像不可發布為社群映像。

  • 公開性:社群映像完全公開,在映像所屬地域下,所有阿里雲帳號均可使用。

  • 功能限制:社群映像不支援共享、匯出或複製。

  • 下架影響:社群映像下架後,將不再對其他阿里雲帳號公開,但已共享的映像關係會繼續保持。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:ModifyImageSharePermission

update

*Image

acs:ecs:{#regionId}:{#accountId}:image/{#imageId}

無 無

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

是

自訂映像所屬的地域 ID。您可以呼叫 DescribeRegions 查看最新的阿里雲地域清單。

cn-hangzhou

ImageId

string

是

被共享的自訂映像 ID。

重要 不再支援共享使用服務金鑰加密的映像,僅支援共享使用使用者主金鑰 CMK 加密的映像,使用服務金鑰加密的映像在共享時將會報錯。

m-bp18ygjuqnwhechc****

LaunchPermission

string

否

說明

該參數正在邀測中,暫不支援使用。

hide

AddAccount

array

否

授權共享映像的阿里雲帳號 ID。N 的取值範圍:1~10,若一次提交超過 10 個阿里雲帳號,系統將只處理前 10 個,忽略多餘的帳號。

1234567890

string

否

授權共享映像的阿里雲帳號 ID。

1234567890

RemoveAccount

array

否

刪除映像共享的阿里雲帳號 ID。N 的取值範圍:1~10,若一次提交超過 10 個阿里雲帳號,系統將只處理前 10 個,忽略多餘的帳號。

1234567890

string

否

刪除映像共享的阿里雲帳號 ID。

1234567890

IsPublic

boolean

否

是否發布或下架社群映像。取值範圍:

  • true:發布該映像為社群映像。

  • false:下架該映像為普通映像,若該映像本身是普通映像,則不做改變。

預設值:false。

false

DryRun

boolean

否

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 MissingParameter The input parameter "RegionId" that is mandatory for processing this request is not supplied.
400 InvalidGroup.Malformed The specified Group is wrongly formed. 指定的群組不存在。
400 UnnecessaryParameter.LaunchPermission The specified parameter "LaunchPermission" is unnecessary if paramter "AddAccounts" or "RemoveAccounts" exist.
400 InvalidParameter.LaunchPermission The specified parameter "LaunchPermission" is invalid.
400 ForbiddenParameter.LaunchPermission The specified parameter "LaunchPermission" is forbidden for current account.
403 AssumeRoleError Requires a RAM role of AliyunECSShareEncryptImageDefaultRole before sharing encrypted image. 您在共用加密映像前,需要新增 AliyunECSShareEncryptImageDefaultRole RAM 角色。
403 ImageDescription.ContainsSensitiveWords The specified image description contains sensitive words. 指定的映像描述包含敏感詞彙。
403 ImageName.ContainsSensitiveWords The specified image name contains sensitive words. 指定的映像名稱包含敏感詞彙。
403 Image.Public The specified image is public image.
403 CurrentRegion.NotSupportPublicImage Public image is not supported for current region.
403 Image.NotPublic The specified image is not public image. 您指定的映像並非公用權限,無法修改為私人權限。
403 OperationDeined.FullImage The encrypted image contains multiple snapshots, which do not support share.
403 QuotaExceed.ShareImage The shared Image Quota exceeds.
403 QuotaExceed.ShareImageUser The shared Image user Quota exceeds.
403 InvalidImageId.BidMismatch Cannot share the image with users %s of other sites. 映像無法跨營運商共用。
403 OperationDeined.EncryptedSnapshot The image contains encrypted snapshots, which do not support share. 該映像包含加密快照。
403 OperationDenied.InvalidImageStatus The specified image cannot be shared when it is deprecated. 指定的自訂映像為棄用狀態,不支援共用。請先呼叫 ModifyImageAttribute 修改指定映像的狀態。
403 PublicImageAgreement.NotSigned The current account has not signed "Community Image Terms of Service". 目前阿里雲帳號未簽署社群映像協議,因此不能將指定的映像發佈為社群映像。您可以呼叫 ModifyUserBusinessBehavior 簽署社群映像協議。
403 InvalidParameter.IsPublic The specified parameter IsPublic is conflicted with other parameters. 指定的參數 IsPublic 與其他參數衝突。
403 InvalidParameter.KMSKeyId.CMKUnauthorized The specified KMS key is not authorized for the ECS service. Please grant the ECS service permission to use the key in the KMS console and try again.
403 InvalidParameter.KMSKeyId.CMKNotEnabled The specified KMS key must be in an enabled state. Please enable the key in the KMS console and try again.
403 InvalidOperation.ServiceKeyEncryptedImageUnsupported The specified image is encrypted with a service key and cannot be shared. Please call the CopyImage operation to encrypt the image with your own KMS key and then share the new image.
403 OperationDenied.KMSKeyUnauthorized The operation is denied due to missing KMS key authorization. Please check the KMS key permissions and ensure the key is properly authorized for this operation.
404 InvalidImageId.NotFound The specified ImageId does not exist. 指定的映像在該使用者帳號下不存在,請您檢查映像 ID 是否正確。
404 InvalidAccount.NotFound The specified account %s in parameter "AddAccount.n" or "RemoveAccount.n" does not exist. 指定的帳號不存在。
404 InvalidAccount.Forbbiden The specified Account does not yourself.
404 InvalidKMSKeyId.NotFound The specified KMSKeyId does not exist. Please verify that the key ID is correct and that the key resides in the current region.

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情。