All Products
Search
Document Center

Elastic Compute Service:DeleteInstance

Last Updated:Feb 04, 2024

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

Operation description

  • After an instance is released, all the physical resources used by the instance are reclaimed by Alibaba Cloud. Data stored on the instance is deleted permanently and cannot be restored.

  • Disk settings may affect their behavior when the instances they are attached to are released. Take note of the following items:

    • If DeleteWithInstance is set to false, the disks are retained as pay-as-you-go disks.
    • If DeleteWithInstance is set to true, the disks are released along with the instance.
    • If DeleteAutoSnapshot is set to false, automatic snapshots of the disks are retained.
    • If DeleteAutoSnapshot is set to true, automatic snapshots of the disks are released.
    • Manual snapshots of the disks are retained.
    • If the response contains {"OperationLocks": {"LockReason" : "security"}}, the instance is locked for security reasons. In this case, even if the DeleteWithInstance parameter is set to false for the data disks that are attached to the instance, the parameter is ignored and the data disks are released along 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.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance.

i-bp1g6zv0ce8oghu7****
ForcebooleanNo

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

  • true: forcefully releases the instance in the Running state.**** This operation is equivalent to performing a hard shut-down. Cache data that is not written to persistent storage will be lost.
  • false: normally releases the instance. This value is valid only for instances in the Stopped state.****

Default value: false.

false
TerminateSubscriptionbooleanNo

Specifies whether to release an expired subscription instance.

Default value: false.

false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status codeError codeError messageDescription
400DependencyViolation.SLBConfiguringSpecified operation is denied as your instance is using by another product.The instance is referenced by an SLB instance that is being configured.
400DependencyViolation.RouteEntrySpecified instance is used by route entry.Custom route entries exist in the VPC and the VPC cannot be deleted.
400InvalidParameterThe input parameter InstanceId is invalid.The specified InstanceId parameter is invalid.
403IncorrectInstanceStatusThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.-
403ChargeTypeViolationThe operation is not permitted due to charge type of the instance.The operation is not supported while the instance is using the current billing method.
403IncorrectInstanceStatus.InitializingThe specified instance status does not support this operation.The specified instance cannot be released at this time. Try again later.
403IncorrectInstanceStatusThe specified instance is still attached by volumes.The specified instance has data volumes.
403InvalidOperation.DeletionProtection%sThe operation is invalid. Disable release protection for the instance first.
403InvalidOperation.DeletionProtectionThe operation is not allowed due to deletion protection.-
403InvalidOperation.EniLinked%sThe 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.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-02-01The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: DryRun
2023-07-17The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500