All Products
Search
Document Center

Elastic Compute Service:DeleteImage

Last Updated:Nov 29, 2023

Deletes a custom image.

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

Action String Yes DeleteImage

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

RegionId String Yes cn-hangzhou

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

ImageId String Yes m-bp67acfmxazb4p****

The ID of the image. If the specified custom image does not exist, the request is ignored.

Force Boolean No false

Specifies whether to forcefully delete the custom image. Valid values:

  • true: forcefully deletes the custom image, regardless of whether the image is being used by other instances.
  • false: verifies that the image is not being used by other instances and then deletes the image.

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=DeleteImage
&ImageId=m-bp67acfmxazb4p****
&RegionId=cn-hangzhou
&Force=false
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DeleteImageResponse>
     <RequestId>CEF72CEB-54B6-4AE8-B225-F876FF7BA984</RequestId>
</DeleteImageResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

HTTP status code

Error code

Error message

Description

403 ImageUsingByInstance The specified image has been used to create instances. The specified image is used to create instances and cannot be deleted.
403 ImageUseShared The specified image has been shared to others. The specified image is already shared with other accounts.
403 OperationDenied.ImageCopying The Image is coping. The image is being copied. Try again later.
403 ImageIsImporting The specified Image is importing. The specified image is being imported. The operation cannot be performed.
403 ImageIsExporting The specified Image is exporting. Please cancel task first. The specified image is being exported. You must cancel the export task before you can delete the image.
403 ImageIsPublic You can not delete public image, please modify it to private. The specified image is a community image and cannot be directly deleted. You must call the ModifyImageSharePermission operation to unpublish the image before you can delete the image.
404 InvalidImageId.NotFound The specified ImageId does not exist. The specified image is not found in the account. Check whether the image ID is correct.

For a list of error codes, see Service error codes.