You can call this operation to release one or more pay-as-you-go instances or expired subscription instances.
Description
- After an instance is released, all the physical resources used by the instance are recycled. Relevant data is erased and cannot be recovered.
- 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 along with the instance. - For disks for which
DeleteAutoSnapshot
is set to false, the automatic snapshots are retained. - For disks for which
DeleteAutoSnapshot
is set to true, the automatic snapshots are released. - Manual snapshots are retained.
- If
OperationLocks
in the DescribeInstances response contains"LockReason" : "security"
for an instance, the 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. For more information, see API behavior when an instance is locked for security reasons.
- 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. |
InstanceId.N | RepeatList | Yes | i-bp1g6zv0ce8oghu7**** |
The ID of instance N that you want to release. Valid values of N: 1 to 100. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. |
DryRun | Boolean | No | false |
Specifies whether to check the validity of the request without actually making the request. Default value: false. Valid values:
|
Force | Boolean | No | false |
Specifies whether to forcibly release the instance in the Running (
|
TerminateSubscription | Boolean | No | false |
Specifies whether to release an 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 value, but you must make sure that it is unique among different requests. The ClientToken value must contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 7B7813C6-57BF-41XX-B12B-F172F65A6046 |
The ID of the request. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=DeleteInstances
&InstanceId.1=i-bp1g6zv0ce8oghu7****
&Force=false
&<Common request parameters>
Sample success responses
XML
format
<DeleteInstancesResponse>
<RequestId>7B7813C6-57BF-41XX-B12B-F172F65A6046</RequestId>
</DeleteInstancesResponse>
JSON
format
{
"RequestId": "7B7813C6-57BF-41XX-B12B-F172F65A6046"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
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 instance is bound with elastic network interfaces (ENIs). |
403 | IncorrectInstanceStatus | %s | The error message returned because the operation is not supported while the instance is in the current state. |
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. If the problem persists, submit a ticket. |
500 | InternalError | %s | The error message returned because an internal error has occurred. |
403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | The error message returned because the operation is not supported while the instance is locked for security reasons. |
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 an SLB instance that is being configured. |
400 | DependencyViolation.RouteEntry | Specified instance is used by route entry. | The error message returned because custom routing entries that include the IP address of the specified instance exist in the current VPC. |
For more information about error codes, see API Error Center.