Associates one or more ApsaraDB RDS instances with a scaling group.

Description

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

  • The ApsaraDB RDS instance and the scaling group must be within the same account.
  • The ApsaraDB RDS instance must be unlocked. For more information about the lock policy, see Limits.
  • The ApsaraDB RDS instance must be in the Running state.

After an ApsaraDB RDS instance is associated with 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 the "Configure IP address whitelists for the RDS instance" section in the Use a database client or the CLI to connect to an ApsaraDB RDS for MySQL instance topic.

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 internal IP addresses of all instances in the specified scaling group to the whitelist that manages access to the ApsaraDB RDS instance. 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 value, but you must ensure that it is unique among different requests.

The token can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

RegionId String No cn-qingdao

The ID of the region where the scaling group resides.

DBInstance.N String Yes rm-bp12cy3****

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

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

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, visit the API Error Center.

HTTP status code

Error code

Error message

Description

404

InvalidScalingGroupId.NotFound

The specified scaling group does not exist.

The error message returned because the specified scaling group does not exist within the current account.

400

QuotaExceeded.RDS

"RDS" quota exceeded.

The error message returned because the maximum number of ApsaraDB RDS instances that can be associated with the scaling group has been reached.

400

InvalidDBInstanceId.NotFound

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

The error message returned because the specified ApsaraDB RDS instance does not exist.

400

IncorrectDBInstanceStatus

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

The error message returned because the operation is not supported while the ApsaraDB RDS instance is in the current state.

400

QuotaExceeded.DBInstanceSecurityIP

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

The error message returned because the maximum number of IP addresses in the whitelist that manages access to the ApsaraDB RDS instance has been reached.

400

InvalidInstanceIds.PrivateIpNotFound

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

The error message returned because the internal IP address of the ApsaraDB RDS instance that is associated with the scaling group cannot be obtained.