All Products
Search
Document Center

Auto Scaling:Creates a scaling rule

Last Updated:Oct 23, 2023

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

Description

In this example, the following parameters are used to create a scaling rule in a scaling group:

  • ScalingGroupId: the ID of the scaling group in which you want to create the scaling rule.

  • ScalingRuleType: the type of the scaling rule. Auto Scaling supports the following types of scaling rules: simple scaling rule, target tracking scaling rule, step scaling rule, and predictive scaling rule.

  • AdjustmentType: the adjustment method of the scaling rule. If you create a simple scaling rule or a step scaling rule, you must specify this parameter.

  • AdjustmentValue: the adjustment value of the scaling rule. If you create a simple scaling rule or a step scaling rule, you must specify this parameter.

For more information about the parameters, see CreateScalingRule.

Sample requests

http(s)://ess.aliyuncs.com/?Action=CreateScalingRule
&ScalingGroupId=asg-bp1ffogfdauy0jw0****
&ScalingRuleName=scalingrule****
&AdjustmentType=QuantityChangeInCapacity
&AdjustmentValue=100
&ScalingRuleType=SimpleScalingRule
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

<CreateScalingRuleResponse>
    <ScalingRuleAri>ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****</ScalingRuleAri>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <ScalingRuleId>asr-bp1dvirgwkoowxk7****</ScalingRuleId>
</CreateScalingRuleResponse>

JSON format

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

{
  "ScalingRuleAri" : "ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****",
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "ScalingRuleId" : "asr-bp1dvirgwkoowxk7****"
}