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 attach an ApsaraDB RDS instance to a scaling group, make sure that the following requirements are met:
The ApsaraDB RDS instance and the scaling group belong to the same Alibaba Cloud account.
The ApsaraDB RDS instance is unlocked. For more information about the lock policy, see ApsaraDB RDS usage notes.
The ApsaraDB RDS instance is in the Running state.
If your scaling group has an attached ApsaraDB RDS instance and you want to attach the same instance to your scaling group again, the number of the ApsaraDB RDS instances attached to your scaling group remains unchanged after the attachment. Instead, Auto Scaling automatically adds the private IP addresses of all Elastic Compute Service (ECS) instances in the scaling group to the IP address whitelist of the ApsaraDB RDS instance.
After an ApsaraDB RDS instance is attached to the scaling group, the default IP address whitelist of 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
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 instances in the scaling group to the IP address whitelist of the ApsaraDB RDS instance during the attachment. Valid values:
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 the ApsaraDB RDS instance N that you want to attach to the scaling group. Valid values of N: 1 to 5. |
RegionId | String | No | cn-qingdao | The region ID of the scaling group. |
AttachMode | String | No | SecurityIp | The method that you want to use to associate the database with the scaling group. Valid values:
Default value: SecurityIp. |
Type | String | No | RDS | The type of the database. Valid values:
Default value: RDS. |
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=AttachDBInstances
&ScalingGroupId=asg-bp1avr6ensitts3w****
&ForceAttach=false
&ClientToken=123e4567-e89b-12d3-a456-42665544****
&DBInstance=["rm-bp12cy3****"]
&RegionId=cn-qingdao
&AttachMode=SecurityIp
&Type=RDS
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<AttachDBInstancesResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</AttachDBInstancesResponse>
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 | Description | Description |
404 | InvalidScalingGroupId.NotFound | The specified scaling group does not exist. | The specified scaling group does not exist within your 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 address of an instance in the scaling group cannot be obtained. |