All Products
Document Center

Elastic Compute Service:DeleteInstances

Last Updated:Apr 11, 2024

Releases pay-as-you-go instances or expired subscription instances.

Operation description

  • After an Elastic Compute Service (ECS) instance is released, all the physical resources used by the instance are recycled. Relevant data is erased and cannot be restored.

  • Disks attached to the instance:

    • The disks for which DeleteWithInstance is set to false are retained as pay-as-you-go disks.
    • The disks for which DeleteWithInstance is set to true are released together with the instance.
    • For disks for which DeleteAutoSnapshot is set to false, the automatic snapshots of the disks are retained.
    • For disks for which DeleteAutoSnapshot is set to true, the automatic snapshots of the disks are released.
    • Manual snapshots of the disks are retained.
    • If OperationLocks in the response contains "LockReason" : "security" for an instance, the instance is locked for security reasons. For more information, see API behavior when an instance is locked for security reasons. Even if DeleteWithInstance is set to false for the data disks that are attached to the instance, this parameter is ignored and the data disks are released along with the instance.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters


Specifies whether to perform only a dry run without performing the actual request. Default value: false. Valid values:

  • true: performs only a dry run. The system checks whether your AccessKey pair is valid, whether RAM users are granted permissions, and whether the required parameters are specified. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DRYRUN.SUCCESS error code is returned.
  • false: performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.

Specifies whether to forcefully release the instance that is in the Running (Running) state. Default value: false. Valid values:

  • true: forcefully releases the instance that is in the Running (Running) state. When the Force parameter is set to true, this operation is equivalent to a power-off operation. Temporary data in the memory and storage of the instance is erased and cannot be restored.
  • false: normally releases the instance. This value is valid only for instances that are in the Stopped (Stopped) state.

Specifies whether to release an expired subscription instance.

Default value: false.


The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.


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


The IDs of instances. You can specify up to 100 instance IDs in a single request.


The ID of the instance.


Response parameters


The request ID.



Sample success responses


  "RequestId": "7B7813C6-57BF-41XX-B12B-F172F65A6046"

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.CrossRegionNotSupportInstances of multiple regions not support.-
400DRYRUN.SUCCESSThis request is a dryrun request with successful result.The request is checked and determined as valid.
400DependencyViolation.SLBConfiguringSpecified operation is denied as your instance is using by another product.The instance is referenced by an SLB instance that is being configured.
400DependencyViolation.RouteEntrySpecified instance is used by route entry.Custom route entries exist in the VPC and the VPC cannot be deleted.
403InvalidParameter.TooManyInstanceIdsInstance ids cannot be more than 100.-
403InvalidInstanceIds.ValueNotSupportedThe specified instanceIds is not valid.-
403InvalidOperation.DeletionProtectionThe operation is not allowed due to deletion protection.-
403InvalidOperation.DeletionProtection%sThe operation is invalid. Disable release protection for the instance first.
403InvalidOperation.EniLinked%sThe operation is invalid because the current ENI of the instance is associated with other ENIs. You must disassociate the ENI from the other ENIs before you can unbind the ENI from the instance.
403IncorrectInstanceStatus%sThe instance is in a state that does not support the current operation.
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.-
404InvalidInstanceIds.NotFoundThe specified InstanceIds does not exist.The specified InstanceId parameter does not exist. You can call the DescribeInstances operation to query the state of the instance.
404InvalidInstanceId.NotFound%sThe specified instance does not exist. Check whether the InstanceId parameter is valid.
500InvalidParameterInvalid parameters.-
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.
500InternalError%sAn internal error has occurred.

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

Change history

Change timeSummary of changesOperation
2023-07-17The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500