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 reclaimed. The data is erased and cannot be restored.
  • The attached disks will be handled based on their settings as follows:
    • The disks with DeleteWithInstance set to false will be retained as pay-as-you-go disks.
    • The disks with DeleteWithInstance to true will be released.
    • For the disks with DeleteAutoSnapshot set to false, the automatic snapshots will be retained.
    • For the disks with DeleteAutoSnapshot set to true, the automatic snapshots will be released.
    • Manual snapshots of all disks will be retained.
    • For an instance whose OperationLocks array contains the "LockReason" : "security" setting, even if DeleteWithInstance of attached data disks is set to false, this value will be ignored and the data disks will be released.

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 No DeleteInstance

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

InstanceId String Yes i-bp1g6zv0ce8oghu7k***

The ID of the instance that you want to release.

TerminateSubscription Boolean No false

Specifies whether to release an expired subscription instance.

Default value: false.

Force Boolean No false

Specifies whether to forcibly release an instance in the Running (Running) state. Default value: false. Valid values:

  • true: forcibly releases an instance in the Running (Running) state. When this value is selected, 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.

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-bp1g6zv0ce8oghu7k***
&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 instance ID is invalid.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified instance ID does not exist.
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.NotInWhiteList %s The error message returned because the operation is invalid. Obtain the permission to call this operation.
403 InvalidOperation.EniLinked %s The error message returned because the operation is not supported while the instance has ENIs attached.

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