All Products
Search
Document Center

Auto Scaling:DetachDBInstances

Last Updated:May 10, 2024

Detaches one or more ApsaraDB RDS instances from a scaling group. If you want to decrease the number of ApsaraDB RDS instances attached to your scaling group, you can call the DetachDBInstance operation. This operation liberates ApsaraDB RDS instances from your scaling group, thereby significantly boosting the agility and efficiency in managing and allocating your resources.

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

DetachDBInstances

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

ScalingGroupId

String

Yes

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

ForceDetach

Boolean

No

false

Specifies whether to remove the private IP addresses of the existing instances in the scaling group from the IP address whitelist of the ApsaraDB RDS instance marked for detachment. Valid values:

  • true

  • false

Default value: false.

ClientToken

String

No

123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request.

You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see Ensure idempotence.

DBInstance.N

String

No

rm-bp12cy3****

The ID of ApsaraDB RDS instance N that you want to detach from your scaling group. You can detach up to five ApsaraDB RDS instances from a scaling group in each call.

RegionId

String

No

cn-qingdao

The region ID of the scaling group.

RemoveSecurityGroup

Boolean

No

false

Specifies whether to remove the security group whitelist of the ApsaraDB RDS instance marked for detachment. This parameter takes effect only if you set AttachMode to SecurityGroup. Valid values:

  • true

  • false

Default value: false.

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The request ID.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DetachDBInstances
&ScalingGroupId=asg-bp1igpak5ft1flyp****
&ForceDetach=false
&ClientToken=123e4567-e89b-12d3-a456-42665544****
&DBInstance=["rm-bp12cy3****"]
&RegionId=cn-qingdao
&RemoveSecurityGroup=false
&<Common request parameters>

Sample success responses

XML format

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

<DetachDBInstancesResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</DetachDBInstancesResponse>

JSON format

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

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

Error codes

For a list of error codes, see Service error codes.

HTTP status code

Error code

Error message

Description

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The specified scaling group does not exist within the Alibaba Cloud account.

400

InvalidDBInstanceId.NotFound

DB instance "%s" does not exist.

The specified ApsaraDB RDS instance does not exist.