You can call this operation to release 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.
  • The attached disks will be handled based on their settings in the following ways:
    • The disks for which the DeleteWithInstance parameter is set to false are retained as pay-as-you-go disks.
    • The disks for which the DeleteWithInstance parameter is set to true are released.
    • For the disks that have DeleteAutoSnapshot set to false, the automatic snapshots are retained.
    • For the disks that have DeleteAutoSnapshot set to true, the automatic snapshots are released.
    • Manual snapshots are retained.
    • For an instance that is under security control and the value of OperationLocks is "LockReason" : "security", even if DeleteWithInstance of attached disks is set to false, the DeleteWithInstance parameter is ignored and disks are released together with the instance. 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 DeleteInstance

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

InstanceId String Yes i-bp1g6zv0ce8oghu7****

The ID of the instance.

Force Boolean No false

Specifies whether to forcibly release an instance in the Running (Running) state.

  • true: forcibly releases an instance 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: normally releases an instance. You can select this value only for an instance in the Stopped (Stopped) state. This is the default value.
TerminateSubscription Boolean No false

Specifies whether to release an 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

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

JSON format

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

Error codes

HTTP status code Error code Error message Description
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.
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.
400 DependencyViolation.SLBConfiguring Specified operation is denied as your instance is using by another product. The error message returned because the specified 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 rules still exist in the current VPC.
400 InvalidParameter The input parameter InstanceId is invalid. The error message returned because the specified InstanceId parameter is invalid.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter does not exist. Check whether the instance ID is correct.
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 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 has ENIs bound.

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