Releases one or more pay-as-you-go instances or expired subscription Elastic Compute Service (ECS) instances.
Usage notes
- After an instance is released, all the physical resources used by the instance are recycled. Relevant data is erased and cannot be recovered.
- Disk settings may affect their behavior when the instances they are attached to are released. Take note of the following items:
- 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 along with the instance. - Automatic snapshots of the disks for which
DeleteAutoSnapshot
is set to false are retained. - Automatic snapshots of the disks for which
DeleteAutoSnapshot
is set to true 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 ifDeleteWithInstance
is set tofalse
for the data disks that are attached to the instance, this parameter is ignored and the data disks are released along with the instance.
- The disks for which
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DeleteInstances | The operation that you want to perform. Set the value to DeleteInstances. |
DryRun | Boolean | No | false | Specifies whether to perform a dry run. Default value: false. Valid values:
|
Force | Boolean | No | false | Specifies whether to forcefully release the instance that is in the Running (
|
TerminateSubscription | Boolean | No | false | Specifies whether to release the expired subscription instance. Default value: false. |
ClientToken | String | No | 123e4567-e89b-12d3-a456-426655440000 | 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. |
RegionId | String | Yes | cn-hangzhou | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. |
InstanceId.N | String | Yes | i-bp1g6zv0ce8oghu7**** | The ID of instance N. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 7B7813C6-57BF-41XX-B12B-F172F65A6046 | The ID of the request. |
Examples
Sample requests
http(s)://ecs.aliyuncs.com/?Action=DeleteInstances
&InstanceId.1=i-bp1g6zv0ce8oghu7****
&Force=false
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DeleteInstancesResponse>
<RequestId>7B7813C6-57BF-41XX-B12B-F172F65A6046</RequestId>
</DeleteInstancesResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "7B7813C6-57BF-41XX-B12B-F172F65A6046"
}
Error codes
HttpCode | Error code | Error message | Description |
---|---|---|---|
400 | DRYRUN.SUCCESS | This request is a dryrun request with successful result. | The error message returned because the validity of the request is checked and determined as valid. |
400 | DependencyViolation.SLBConfiguring | Specified operation is denied as your instance is using by another product. | The error message returned because the instance is referenced by a Server Load Balancer (SLB) instance that is being configured. |
400 | DependencyViolation.RouteEntry | Specified instance is used by route entry. | The error message returned because custom routing rules exist in the virtual private cloud (VPC) and the VPC cannot be deleted. |
500 | InternalError | The request processing has failed due to some unknown error. | The error message returned because an internal error has occurred. Try again later. |
500 | InternalError | %s | The error message returned because an internal error has occurred. |
403 | InvalidOperation.DeletionProtection | %s | The error message returned because the operation is invalid. Disable release protection for the instance first. |
403 | InvalidOperation.EniLinked | %s | The error message returned because the operation is not supported while the elastic network interface (ENI) of the instance is associated with other ENIs. You must disassociate the ENI from the other ENIs before you can detach the ENI from the instance. |
403 | IncorrectInstanceStatus | %s | The error message returned because the operation is not supported while the instance is in the current state. |
403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | The error message returned because the instance is locked for security reasons. |
404 | InvalidInstanceIds.NotFound | The specified InstanceIds does not exist. | The error message returned because the specified instance ID does not exist. Check whether the specified instance ID is valid. You can call the DescribeInstances operation to query the states of specific instances. |
404 | InvalidInstanceId.NotFound | %s | The error message returned because the specified InstanceId parameter does not exist. |
For a list of error codes, see Service error codes.