Releases one or more pay-as-you-go Elastic Compute Service (ECS) instances or expired subscription ECS instances.
Operation description
Usage notes
-
After an ECS instance is released, all the physical resources used by the instance are recycled. Relevant data is erased and cannot be restored.
-
When you release an ECS instance, take note of the following items for the disks attached to the instance:
- The disks for which
DeleteWithInstance
is set to false are retained as pay-as-you-go disks after the instance is released. - The disks for which
DeleteWithInstance
is set to true are released along with the instance. - If
DeleteAutoSnapshot
is set to false for a disk attached to the instance, the automatic snapshots of the disk are retained when the instance is released. - If
DeleteAutoSnapshot
is set to true for a disk attached to the instance, the automatic snapshots of the disk are released along with the instance. - Manual snapshots of the disks are retained.
- If
OperationLocks
in the response contains"LockReason" : "security"
when you query the information of the instance, the instance is locked for security reasons. In this case, even ifDeleteWithInstance
is set tofalse
for the disks that are attached to the instance, the system ignores the DeleteWithInstance value and releases the disks along with the instance. For more information, see API behavior when an instance is locked for security reasons.
- The disks for which
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:DeleteInstances | delete |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
DryRun | boolean | No | Specifies whether to perform only a dry run without performing the actual request. Default value: false. Valid values:
| false |
Force | boolean | No | Specifies whether to forcefully release the instance that is in the Running (
| false |
TerminateSubscription | boolean | No | Specifies whether to release an expired subscription instance. Default value: false. | false |
ClientToken | string | No | 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. | 123e4567-e89b-12d3-a456-426655440000 |
RegionId | string | Yes | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
InstanceId | array | Yes | The IDs of instances. You can specify up to 100 instance IDs in a single request. | |
string | Yes | The ID of the instance. | i-bp1g6zv0ce8oghu7**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "7B7813C6-57BF-41XX-B12B-F172F65A6046"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.CrossRegionNotSupport | Instances of multiple regions not support. | - |
400 | DRYRUN.SUCCESS | This request is a dryrun request with successful result. | The request is checked and determined as valid. |
400 | DependencyViolation.SLBConfiguring | Specified operation is denied as your instance is using by another product. | The instance is referenced by an SLB instance that is being configured. |
400 | DependencyViolation.RouteEntry | Specified instance is used by route entry. | Custom route entries exist in the VPC and the VPC cannot be deleted. |
403 | InvalidParameter.TooManyInstanceIds | Instance ids cannot be more than 100. | - |
403 | InvalidInstanceIds.ValueNotSupported | The specified instanceIds is not valid. | - |
403 | InvalidOperation.DeletionProtection | The operation is not allowed due to deletion protection. | - |
403 | InvalidOperation.DeletionProtection | %s | The operation is invalid. Disable release protection for the instance first. |
403 | ChargeTypeViolation | %s | - |
403 | IncorrectInstanceStatus.Initializing | %s | - |
403 | InvalidOperation.EniLinked | %s | The 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. |
403 | IncorrectInstanceStatus | %s | The instance is in a state that does not support the current operation. |
403 | InstanceLockedForSecurity | The specified operation is denied as your instance is locked for security reasons. | - |
404 | InvalidInstanceIds.NotFound | The 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. |
404 | InvalidInstanceId.NotFound | %s | The specified instance does not exist. Check whether the InstanceId parameter is valid. |
500 | InvalidParameter | Invalid parameters. | - |
500 | InternalError | The request processing has failed due to some unknown error. | An internal error has occurred. Try again later. |
500 | InternalError | %s | An internal error has occurred. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-07-17 | The Error code has changed | View Change Details |