Deletes or releases multiple pay-as-you-go instances or expired subscription instances in a batch. You can use parameters to specify whether to release or convert cloud disks to pay-as-you-go disks and retain them.
Operation description
Manual snapshots of cloud disks are retained and continue to incur charges. You can call DeleteSnapshot to delete them.
- Whether cloud disks and automatic snapshots attached to the instance are released depends on the parameter settings specified when they were created. Before you release an instance, you can call DescribeDisks and ModifyDiskAttribute to query and modify the related parameter settings:
If
DeleteWithInstance=false, the cloud disk is converted to a pay-as-you-go cloud disk and retained. Otherwise, the cloud disk is released along with the instance.If
DeleteAutoSnapshot=false, the automatic snapshots are retained. Otherwise, the automatic snapshots are released along with the instance.
- Elastic IP addresses (EIPs) are not released along with the instance. You can call ReleaseEipAddress to release them.
.Important For security-locked instances, even if the
DeleteWithInstanceparameter of a cloud disk is set tofalse, this attribute is ignored and the cloud disk is released along with the instance.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DeleteInstances |
delete |
*Instance
|
None | 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. |
false |
| Force |
boolean |
No |
Specifies whether to forcefully release an instance that is in the Running (
Default value: false. Warning Forceful release is equivalent to powering off ECS instance. All in-memory data and temporary data in the storage are erased and cannot be recovered. |
false |
| ForceStop |
boolean |
No |
Specifies whether to forcefully shut down the instance before release when the instance is in the Running (
Default value: true. |
true |
| 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 make sure that the token is unique among different requests. The ClientToken value 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 instances. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| InstanceId |
array |
Yes |
The instance ID array. Array length: 1 to 100. |
i-bp1g6zv0ce8oghu7**** |
|
string |
No |
The instance ID. |
i-bp1g6zv0ce8oghu7**** |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
7B7813C6-57BF-41XX-B12B-F172F65A6046 |
Examples
Success response
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. | |
| 400 | DependencyViolation.RouteEntry | Specified instance is used by route entry. | Custom route entries exist in the VPC and the VPC cannot be deleted. |
| 500 | InvalidParameter | Invalid parameters. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | InvalidParameter.TooManyInstanceIds | Instance ids cannot be more than 100. | InstanceIds 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. | Instance has release protection turned on, so this operation cannot be performed |
| 403 | ChargeTypeViolation | %s | The payment type conflicts. This operation is not supported for resources of the payment type. |
| 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. | |
| 403 | OperationDenied.SystemInstanceNotSupport | The system instance does not support the %s operation because %s. | |
| 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 |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.