Releases a pay-as-you-go instance or an expired subscription instance.

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:
    • 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 of the disks are retained.
    • For disks for which DeleteAutoSnapshot is set to true, the automatic snapshots of the disks 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 if DeleteWithInstance is set to false for the data disks that are attached to the instance, this parameter is ignored and the data disks are released along with the instance.

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 DeleteInstance

The operation that you want to perform. Set the value to DeleteInstance.

InstanceId String Yes i-bp1g6zv0ce8oghu7****

The ID of the instance that you want to release.

Force Boolean No false

Specifies whether to forcefully release the instance in the Running (Running) state. Valid values:

  • true: forcefully releases the instance in the Running (Running) state. When the Force parameter is set to true, this operation is equivalent to the power-off operation. Temporary data in the memory and storage of the instance is erased and cannot be restored.
  • false: normally releases the instance. This value is valid only for instances in the Stopped (Stopped) state.

Default value: false.

TerminateSubscription Boolean No false

Specifies whether to release the expired subscription instance.

Default value: false.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DeleteInstance
&InstanceId=i-bp1g6zv0ce8oghu7****
&Force=false
&TerminateSubscription=false
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DeleteInstanceResponse>
    <RequestId>928E2273-5715-46B9-A730-238DC996A533</RequestId>
</DeleteInstanceResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "928E2273-5715-46B9-A730-238DC996A533"
}

Error codes

HTTP status code Error code Error message Description
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 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 still exist in the virtual private cloud (VPC).
400 InvalidParameter The input parameter InstanceId is invalid. The error message returned because the specified InstanceId parameter is invalid.
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 error persists, submit a ticket.
403 IncorrectInstanceStatus The current status of the resource does not support this operation. The error message returned because the operation is not supported while the resource 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 operation is not supported while the instance is locked for security reasons.
403 ChargeTypeViolation The operation is not permitted due to charge type of the instance. The error message returned because the billing method of the instance does not support this operation.
403 IncorrectInstanceStatus.Initializing The specified instance status does not support this operation. The error message returned because the instance is being initialized and cannot be released. Try again later.
403 IncorrectInstanceStatus The specified instance is still attached by volumes. The error message returned because the specified instance still has data volumes.
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). You must unbind the ENIs before you can release the instance.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter is invalid.

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