All Products
Search
Document Center

Auto Scaling:Creates a scaling group

Last Updated:Oct 23, 2023

This topic provides an example of how to call an API operation to create a scaling group.

Description

In this example, the following parameters are used to create and configure a scaling group:

  • MinSize: the minimum number of Elastic Compute Service (ECS) instances that must be contained in the scaling group. When the number of ECS instances in the scaling group is smaller than the value of the MinSize parameter, Auto Scaling creates ECS instances in the scaling group to reach the minimal number.

  • MaxSize: the maximum number of ECS instances that can be contained in the scaling group. When the number of ECS instances in the scaling group is greater than the value of the MaxSize parameter, Auto Scaling removes excess ECS instances from the scaling group to keep the number of ECS instances within the valid range.

  • LoadBalancerIds: the IDs of the Classic Load Balancer (CLB, formerly known as SLB) instances that you want to associate with the scaling group. The value can be a JSON array that contains multiple CLB instance IDs. Separate multiple IDs with commas (,).

  • DBInstanceIds: the IDs of the ApsaraDB RDS instances that you want to associate with the scaling group. The value can be a JSON array that contains multiple ApsaraDB RDS instance IDs. Separate multiple IDs with commas (,).

For more information about the parameters, see CreateScalingGroup.

Sample requests

http(s)://ess.aliyuncs.com/?Action=CreateScalingGroup
&ScalingGroupName=scalinggroup****
&InstanceId=i-28wt4****
&RegionId=cn-qingdao
&MinSize=2
&MaxSize=20
&LoadBalancerIds=["lb-bp1u7etiogg38yvwz****", "lb-bp168cqrux9ai9l7f****", "lb-bp1jv3m9zvj22ufxp****"]
&DBInstanceIds=["rm-bp142f86de0t7****", "rm-bp18l1z42ar4o****", "rm-bp1lqr97h4aqk****"]
&<Common request parameters>

Sample success responses

XML format

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

<CreateScalingGroupResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <ScalingGroupId>asg-bp14wlu85wrpchm0****</ScalingGroupId>
</CreateScalingGroupResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "ScalingGroupId" : "asg-bp14wlu85wrpchm0****"
}