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 restored.
  • Disks attached to the instance:
    • If the condition DeleteWithInstance=false is met, the disks will be retained as pay-as-you-go disks.
    • If the condition DeleteWithInstance=true is met, the disks will be released with the instance.
    • If the condition DeleteAutoSnapshot=false is met, automatic snapshots will be retained.
    • If the condition DeleteAutoSnapshot=true is met, automatic snapshots will be released with the disks.
    • Manual snapshots are retained.
    • If the OperationLocks parameter of the instance is "LockReason" : "security" and the DeleteWithInstance parameter of the disks is set to false, the system still releases the disks. For more information, see API behavior when an instance is locked for security reasons.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DeleteInstances

The operation that you want to perform. If you use a custom HTTP URL or HTTPS URL to make an API request, you must specify the Action parameter. Set the value to DeleteInstances.

InstanceId.N RepeatList Yes i-bp1g6zv0ce8oghu7k***

The ID of instance N. 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 request only. Default value: false.

  • true: The request is checked but available resources are not queried. Check items include whether your AccessKey pair is valid, whether RAM users are authorized, and whether the required parameters are set. If the check fails, the corresponding error message is returned. If the check succeeds, the DRYRUN.SUCCESS error code is returned.
  • false: The request is checked, and a 2XX HTTP status code is returned and instances are queried if the check succeeds.
Force Boolean No false

Specifies whether to forcibly release instances that are in the Running (Running) state. Default value: false.

  • true: forcibly releases instances that are in the Running (Running) state. When you set this parameter to true, temporary data in the memory and storage of the instance is erased and cannot be restored.
  • false: releases instances normally. This value can be set only for instances in the Stopped (Stopped) state.
TerminateSubscription Boolean No false

Specifies whether to release expired subscription instances.

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 ensure that it is unique among different requests. The ClientToken parameter can only contain 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-bp1g6zv0ce8oghu7k***
&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.NotInWhiteList %s The error message returned because the operation is invalid. Apply for the permission to call this operation first.
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 an Elastic Network Interface (ENI) is attached to the instance.
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 undergoing configuration.
400 DependencyViolation.RouteEntry Specified instance is used by route entry. The error message returned because custom routing rules still exist in the current VPC.

For a list of error codes, visit the API Error Center.