全部產品
Search
文件中心

Elastic Compute Service:DeleteImage

更新時間:Jun 18, 2026

呼叫 DeleteImage 介面,並可以指定參數 ImageId、Force 刪除一份自訂映像。

介面說明

對於不允許刪除自訂映像的情況以及映像刪除後的注意事項,請參見刪除自訂映像

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:DeleteImage

delete

*Image

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

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

自訂映像所在的地域 ID。您可以呼叫 DescribeRegions 查看最新的阿里雲地域列表。

cn-hangzhou

ImageId

string

映像 ID。如果指定的自訂映像不存在,則請求將被忽略。

m-bp67acfmxazb4p****

Force

boolean

是否執行強制刪除。取值範圍:

  • true:強制刪除自訂映像,忽略當前映像是否被其他執行個體使用。

  • false:正常刪除自訂映像,刪除前檢查當前映像是否被其他執行個體使用。

預設值:false。

false

DryRun

boolean

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

樣本

正常返回樣本

JSON格式

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

異常返回樣本

JSON格式

{
    "RequestId": "CEF72CEB-54B6-4AE8-B225-F876FF7BA984"
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

403 ImageUsingByInstance The specified image has been used to create instances. You can use the DescribeInstances API to query these instances, or you can use the force parameter to proceed.
403 ImageUseShared The specified image has been shared to others. You can use the DescribeImageSharePermission API to query the users who have been shared.
403 OperationDenied.ImageCopying The image is being copied. Please use the CancelCopyImage API.
403 ImageIsImporting The specified Image is importing.
403 ImageIsExporting The specified image is currently being exported. You can use the DescribeTasks API to check the status of related tasks and cancel them if needed.
403 ImageIsPublic You can not delete public image, please modify it to private.
404 InvalidImageId.NotFound The specified ImageId does not exist.

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

變更歷史

更多資訊,參考變更詳情