You can call the DeleteDBInstance operation to release an ApsaraDB RDS instance.

Before you call this operation, make sure that the following requirements are met:

  • The instance is in the Running state.
  • The read/write splitting feature is disabled for the instance.
  • The instance is a primary, read-only, disaster recovery, or temporary instance. If the instance is a primary instance, it uses the pay-as-you-go billing method.
Note You can manually release an instance in the ApsaraDB RDS console. For more information, see Release an 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 DeleteDBInstance

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

DBInstanceId String Yes rm-uf6wjk5****

The ID of the instance. You can call the DescribeDBInstances operation to query the ID of the instance.

ReleasedKeepPolicy String No Lastest

The policy based on which ApsaraDB RDS retains archived backup files after the instance is released. Valid values:

  • None: No archived backup files are retained.
  • Lastest: Only the last archived backup file is retained.
  • All: All archived backup files are retained.
Note This parameter is supported only when the instance runs MySQL and uses local SSDs.

Response parameters

Parameter Type Example Description
RegionId String ap-southeast-1

The region ID of the instance.

RequestId String 65BDA532-28AF-4122-AA39-B382721EEE64

The ID of the request.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DeleteDBInstance
&DBInstanceId=rm-uf6wjk5****
&<Common request parameters>

Sample success responses

XML format

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

<DeleteDBInstanceResponse>
<RequestId>65BDA532-28AF-4122-AA39-B382721EEE64</RequestId>
<RegionId>ap-southeast-1</RegionId>
</DeleteDBInstanceResponse>

JSON format

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

{
  "RequestId" : "65BDA532-28AF-4122-AA39-B382721EEE64",
  "RegionId" : "ap-southeast-1"
}

Error codes

HTTP status code Error code Error message Description
400 EngineMigration.ActionDisabled Specified action is disabled while custins is in engine migration. The error message returned because the specified operation is disabled during the engine migration for the instance.
403 OperationDenied.PrePayTypeNotSupported The operation is not permitted due to pay type of instance. The error message returned because the instance is a subscription instance and cannot be directly deleted.

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