All Products
Search
Document Center

Auto Scaling:AttachDBInstances

Last Updated:Mar 21, 2024

Attaches ApsaraDB RDS instances to a scaling group. You can adjust the number of ApsaraDB RDS instances attached to your scaling group based on your business requirements to increase usage flexibility.

Usage notes

Before you associate an ApsaraDB RDS instance with a scaling group, make sure that the following requirements are met:

  • The ApsaraDB RDS instance and the scaling group must belong to the same Alibaba Cloud account.

  • The ApsaraDB RDS instance must be unlocked. For more information about the lock policy, see ApsaraDB RDS usage notes.

  • The ApsaraDB RDS instance must be in the Running state.

After an ApsaraDB RDS instance is attached to the scaling group, the default whitelist that manages access to the ApsaraDB RDS instance can contain no more than 1,000 IP addresses. For more information, see Configure IP address whitelists for the RDS 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

AttachDBInstances

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

ScalingGroupId

String

Yes

asg-bp1avr6ensitts3w****

The ID of the scaling group.

ForceAttach

Boolean

No

false

Specifies whether to add the private IP addresses of all instances in the scaling group to the IP address whitelist of ApsaraDB RDS instance N. Valid values:

  • true

  • false

Default value: false.

ClientToken

String

No

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

The client token that you want to use 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 How to ensure idempotence.

DBInstance.N

String

No

rm-bp12cy3****

The ID of ApsaraDB RDS instance N. Valid values of N: 1 to 5.

RegionId

String

No

cn-qingdao

The region ID of the scaling group.

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The request ID.

Examples

Sample requests

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

Sample success responses

XML format

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

<AttachDBInstancesResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</AttachDBInstancesResponse>

JSON format

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

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

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

QuotaExceeded.RDS

"RDS" quota exceeded.

The maximum number of ApsaraDB RDS instances that can be attached to the scaling group has been reached.

400

InvalidDBInstanceId.NotFound

The specified value of parameter "%s" is not valid.

The specified ApsaraDB RDS instance does not exist.

400

IncorrectDBInstanceStatus

The current status of DB instance "%s" does not support this action.

The operation is not supported when the ApsaraDB RDS instance is in the current state.

400

QuotaExceeded.DBInstanceSecurityIP

Security IP quota exceeded in DB instance "%s".

The maximum number of IP addresses in the IP address whitelist of the ApsaraDB RDS instance has been reached.

400

InvalidInstanceIds.PrivateIpNotFound

Can not find all private ips of instances in specific scaling group.

The private IP addresses of instances in the scaling group cannot be obtained.