You can call this operation to delete 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
ImageId String Yes m-bp67acfmxazb4ph***

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

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 No DeleteImage

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

Force Boolean No false

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

  • true: force deletes the custom image, regardless of whether the image is currently being used by other instances.
  • false: verifies that the image is not currently used by any other instances before the system 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-bp67acfmxazb4ph***
&RegionId=cn-hangzhou
&Force=false
&<Common request parameters>

Sample success responses

XML format

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

JSON format

{
    "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 error message returned because the specified image is currently in use for instance creation and cannot be deleted.
403 ImageUseShared The specified image has been shared to others. The error message returned because the specified image is already shared to other accounts.
403 OperationDenied.ImageCopying The Image is coping. The error message returned because the source image is being copied. Try again later.
403 ImageIsCreating The specified image is being created. The error message returned because the specified image is being created.
403 ImageIsImporting The specified Image is importing. The error message returned because the specified image is being imported and cannot be operated on.
403 ImageIsExporting The specified Image is exporting. Please cancel task first. The error message returned because the specified image is being exported. Cancel the export task first.

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