Queries scaling rules.

Usage notes

You can specify a scaling group ID to query all scaling rules in the scaling group. You can also specify the scaling rule ID, name, unique identifier, and type in the request parameters as filter conditions.

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

ParameterTypeRequiredExampleDescription
ActionStringYesDescribeScalingRules

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

RegionIdStringYescn-qingdao

The region ID of the scaling group.

PageNumberIntegerNo1

The number of the page to return. Pages start from page 1.

Default value: 1

PageSizeIntegerNo50

The number of entries to return on each page. Valid values: 1 to 50.

Default value: 10

ScalingGroupIdStringNoasg-bp1ffogfdauy0jw0****

The ID of the scaling group whose scaling rules you want to query.

ScalingRuleTypeStringNoSimpleScalingRule

The type of the scaling rule. Valid values:

  • SimpleScalingRule: scales the number of Elastic Compute Service (ECS) instances based on the values of AdjustmentType and AdjustmentValue.
  • TargetTrackingScalingRule: calculates the number of ECS instances that must be scaled and maintains the value of a predefined metric close to the value of TargetValue.
  • StepScalingRule: scales ECS instances in steps based on the specified thresholds and metric values.
  • PredictiveScalingRule: uses machine learning to analyze historical monitoring data of the scaling group and predicts the future values of metrics. In addition, Auto Scaling creates scheduled tasks to adjust the minimum and maximum numbers of instances for the scaling group.
ShowAlarmRulesBooleanNofalse

Specifies whether to return the event-triggered tasks that are associated with the scaling rules. Valid values:

  • true
  • false

Default value: false

ScalingRuleId.NStringNoasr-bp1dvirgwkoowxk7****

The ID of scaling rule N that you want to query. Valid values of N: 1 to 10.

ScalingRuleName.NStringNoscalingrule****

The name of scaling rule N that you want to query. Valid values of N: 1 to 10.

ScalingRuleAri.NStringNoari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****

The unique identifier of scaling rule N that you want to query. Valid values of N: 1 to 10.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The ID of the request.

PageNumberInteger1

The page number of the returned page.

PageSizeInteger50

The number of entries returned per page.

TotalCountInteger1

The total number of scaling rules.

ScalingRulesArray of ScalingRule

The information about the scaling rules.

ScalingRule
MetricNameStringCpuUtilization

The predefined metric of the scaling rule. If you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule, you must specify this parameter.

Valid values if ScalingRuleType is set to TargetTrackingScalingRule:

  • CpuUtilization: the average CPU utilization
  • ClassicInternetRx: the average inbound Internet traffic over the classic network
  • ClassicInternetTx: the average outbound Internet traffic over the classic network
  • VpcInternetRx: the average inbound Internet traffic over a virtual private cloud (VPC)
  • VpcInternetTx: the average outbound Internet traffic over a VPC
  • IntranetRx: the average inbound traffic over the internal network
  • IntranetTx: the average outbound traffic over the internal network

    Valid values if ScalingRuleType is set to PredictiveScalingRule:

  • CpuUtilization: the average CPU utilization
  • IntranetRx: the average inbound traffic over the internal network
  • IntranetTx: the average outbound traffic over the internal network
AdjustmentTypeStringQuantityChangeInCapacity

The adjustment method of the scaling rule. Valid values:

  • QuantityChangeInCapacity: adds the specified number of ECS instances to or removes the specified number of ECS instances from the scaling group.
  • PercentChangeInCapacity: adds the specified percentage of ECS instances to or removes the specified percentage of ECS instances from the scaling group.
  • TotalCapacity: adjusts the number of ECS instances in the scaling group to a specified number.
InitialMaxSizeInteger100

The maximum number of ECS instances that can be added to the scaling group. If you specify InitialMaxSize, you must also specify PredictiveValueBehavior.

EstimatedInstanceWarmupInteger300

The warmup period of an ECS instance.

ScaleOutEvaluationCountInteger3

The number of consecutive times that the event-triggered task created for scale-outs must meet the threshold conditions before an alert is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

PredictiveScalingModeStringPredictAndScale

The mode of the predictive scaling rule. Valid values:

  • PredictAndScale: provides predictions and creates prediction tasks.
  • PredictOnly: provides predictions but does not create prediction tasks.
MinAdjustmentMagnitudeInteger1

The minimum number of instances that must be scaled. This parameter takes effect only if you set ScalingRuleType to SimpleScalingRule or StepScalingRule, and AdjustmentType to PercentChangeInCapacity.

ScalingRuleAriStringari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****

The unique identifier of the scaling rule.

PredictiveTaskBufferTimeInteger30

The amount of buffer time before the prediction task runs. By default, all prediction tasks that are automatically created by a predictive scaling rule run on the hour. You can specify a buffer time to run prediction tasks and prepare resources in advance. Valid values: 0 to 60. Unit: minutes.

MinSizeInteger1

The minimum number of ECS instances that the scaling group must contain.

ScalingGroupIdStringasg-bp1ffogfdauy0jw0****

The ID of the scaling group whose scaling rules are queried.

PredictiveValueBehaviorStringMaxOverridePredictiveValue

The action on the predicted maximum value. Valid values:

  • MaxOverridePredictiveValue: uses the initial maximum capacity as the maximum value for prediction tasks if the predicted value is greater than the initial maximum capacity.
  • PredictiveValueOverrideMax: uses the predicted value as the maximum value for prediction tasks if the predicted value is greater than the initial maximum capacity.
  • PredictiveValueOverrideMaxWithBuffer: increases the predicted value by a ratio that is specified by PredictiveValueBuffer, and uses the increased value as the maximum value for prediction tasks if the predicted value increased by the ratio is greater than the initial maximum capacity.
TargetValueFloat0.125

The target value.

CooldownInteger20

The cooldown period of the scaling rule. This parameter is available only if you set ScalingRuleType to SimpleScalingRule. Valid values: 0 to 86400. Unit: seconds.

MaxSizeInteger2

The maximum number of ECS instances that the scaling group can contain.

PredictiveValueBufferInteger50

The ratio based on which the predicted value is increased if you set PredictiveValueBehavior to PredictiveValueOverrideMaxWithBuffer. If the predicted value that is increased by this ratio is greater than the initial maximum capacity, the increased value is used as the maximum value for prediction tasks. Valid values: 0 to 100.

ScalingRuleTypeStringSimpleScalingRule

The type of the scaling rule. Valid values:

  • SimpleScalingRule: adjusts the number of ECS instances based on the values of AdjustmentType and AdjustmentValue.
  • TargetTrackingScalingRule: calculates the number of ECS instances that must be scaled and maintains the value of a predefined metric close to the value of TargetValue.
  • StepScalingRule: scales ECS instances in steps based on the specified thresholds and metric values.
  • PredictiveScalingRule: uses machine learning to analyze historical monitoring data of the scaling group and predicts the future values of metrics. In addition, Auto Scaling creates scheduled tasks to adjust the minimum and maximum numbers of instances for the scaling group.
AdjustmentValueInteger1

The number of instances that need to be scaled based on the scaling rule.

ScaleInEvaluationCountInteger15

The number of consecutive times that the event-triggered task created for scale-ins must meet the threshold conditions before an alert is triggered. After a target tracking scaling rule is created, an event-triggered task is automatically created and associated with the target tracking scaling rule.

DisableScaleInBooleantrue

Indicates whether to disable scale-in. This parameter takes effect only if you set ScalingRuleType to TargetTrackingScalingRule. Valid values:

  • true
  • false
ScalingRuleNameStringscalingrule****

The name of the scaling rule.

ScalingRuleIdStringasr-bp1dvirgwkoowxk7****

The ID of the scaling rule.

AlarmsArray of Alarm

The event-triggered tasks that are associated with the scaling rule. This parameter is returned only if you set ShowAlarmRules to true. Otherwise, an empty list is returned.

Alarm
AlarmTaskIdStringasg-bp18p2yfxow2dloq****_1f9458d1-70e1-4bee-8c7f-7a47695b****

The ID of the event-triggered task that is associated with the scaling rule.

ComparisonOperatorString>=

The comparison operator between the statistical value and the threshold of the metric in the event-triggered task that is associated with the scaling rule. The comparison operator indicates the relationship in which the metric value and the metric threshold can meet the alert condition.

  • Valid value if the metric value is greater than or equal to the metric threshold: >=
  • Valid value if the metric value is less than or equal to the metric threshold: <=
  • Valid value if the metric value is greater than the metric threshold: >
  • Valid value if the metric value is less than the metric threshold: <
MetricNameStringCpuUtilization

The name of the metric in the event-triggered task that is associated with the scaling rule.

EvaluationCountInteger3

The number of consecutive times that the event-triggered task that is associated with the scaling rule must meet the alert condition before an alert is triggered.

AlarmTaskNameStringalarmtask****

The name of the event-triggered task that is associated with the scaling rule.

MetricTypeStringsystem

The type of the metric in the event-triggered task that is associated with the scaling rule. Valid values:

  • system: system metric
  • custom: custom metric
ThresholdFloat50

The threshold of the metric in the event-triggered task that is associated with the scaling rule.

StatisticsStringAverage

The statistical method of the event-triggered task that is associated with the scaling rule. Valid values:

  • Average
  • Maximum
  • Minimum
DimensionsArray of Dimension

The dimensions of the event-triggered task that is associated with the scaling rule.

Dimension
DimensionKeyStringscaling_group

The dimension key of the event-triggered task that is associated with the scaling rule. Valid values:

  • scaling_group: the ID of the scaling group
  • userId: the ID of the Alibaba Cloud account
DimensionValueStringasg-bp18p2yfxow2dloq****

The dimension value of the event-triggered task that is associated with the scaling rule.

StepAdjustmentsArray of StepAdjustment

The step adjustments of the step scaling rule.

StepAdjustment
MetricIntervalUpperBoundFloat5.0

The upper limit of a step adjustment. Valid values: -9.999999E18 to 9.999999E18.

ScalingAdjustmentInteger1

The number of ECS instances that are scaled in each step adjustment.

MetricIntervalLowerBoundFloat1.0

The lower limit of a step adjustment. Valid values: -9.999999E18 to 9.999999E18.

AlarmDimensionsArray of AlarmDimension

The dimensions of the metric. This parameter takes effect only if you set ScalingRuleType to TargetTrackingScalingRule. For example, if you use metric LoadBalancerRealServerAverageQps, you must specify dimension rulePool.

AlarmDimension
DimensionKeyStringrulePool

The dimension key of the metric.

DimensionValueStringsgp-l1cbirz451yxu2****

The dimension value of the metric.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DescribeScalingRules
&RegionId=cn-qingdao
&PageNumber=1
&PageSize=50
&ScalingGroupId=asg-bp1ffogfdauy0jw0****
&ScalingRuleType=SimpleScalingRule
&ShowAlarmRules=false
&ScalingRuleId=["asr-bp1dvirgwkoowxk7****"]
&ScalingRuleName=["scalingrule****"]
&ScalingRuleAri=["ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****"]
&<Common request parameters>

Sample success responses

XML format

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

<DescribeScalingRulesResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <PageNumber>1</PageNumber>
    <PageSize>50</PageSize>
    <TotalCount>1</TotalCount>
    <ScalingRules>
        <MetricName>CpuUtilization</MetricName>
        <AdjustmentType>QuantityChangeInCapacity</AdjustmentType>
        <InitialMaxSize>100</InitialMaxSize>
        <EstimatedInstanceWarmup>300</EstimatedInstanceWarmup>
        <ScaleOutEvaluationCount>3</ScaleOutEvaluationCount>
        <PredictiveScalingMode>PredictAndScale</PredictiveScalingMode>
        <MinAdjustmentMagnitude>1</MinAdjustmentMagnitude>
        <ScalingRuleAri>ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****</ScalingRuleAri>
        <PredictiveTaskBufferTime>30</PredictiveTaskBufferTime>
        <MinSize>1</MinSize>
        <ScalingGroupId>asg-bp1ffogfdauy0jw0****</ScalingGroupId>
        <PredictiveValueBehavior>MaxOverridePredictiveValue</PredictiveValueBehavior>
        <TargetValue>0.125</TargetValue>
        <Cooldown>20</Cooldown>
        <MaxSize>2</MaxSize>
        <PredictiveValueBuffer>50</PredictiveValueBuffer>
        <ScalingRuleType>SimpleScalingRule</ScalingRuleType>
        <AdjustmentValue>1</AdjustmentValue>
        <ScaleInEvaluationCount>15</ScaleInEvaluationCount>
        <DisableScaleIn>true</DisableScaleIn>
        <ScalingRuleName>scalingrule****</ScalingRuleName>
        <ScalingRuleId>asr-bp1dvirgwkoowxk7****</ScalingRuleId>
        <Alarms>
            <AlarmTaskId>asg-bp18p2yfxow2dloq****_1f9458d1-70e1-4bee-8c7f-7a47695b****</AlarmTaskId>
            <ComparisonOperator>&gt;=</ComparisonOperator>
            <MetricName>CpuUtilization</MetricName>
            <EvaluationCount>3</EvaluationCount>
            <AlarmTaskName>alarmtask****</AlarmTaskName>
            <MetricType>system</MetricType>
            <Threshold>50</Threshold>
            <Statistics>Average</Statistics>
            <Dimensions>
                <DimensionKey>scaling_group</DimensionKey>
                <DimensionValue>asg-bp18p2yfxow2dloq****</DimensionValue>
            </Dimensions>
        </Alarms>
        <StepAdjustments>
            <MetricIntervalUpperBound>5</MetricIntervalUpperBound>
            <ScalingAdjustment>1</ScalingAdjustment>
            <MetricIntervalLowerBound>1</MetricIntervalLowerBound>
        </StepAdjustments>
        <AlarmDimensions>
            <DimensionKey>rulePool</DimensionKey>
            <DimensionValue>sgp-l1cbirz451yxu2****</DimensionValue>
        </AlarmDimensions>
    </ScalingRules>
</DescribeScalingRulesResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "PageNumber" : 1,
  "PageSize" : 50,
  "TotalCount" : 1,
  "ScalingRules" : [ {
    "MetricName" : "CpuUtilization",
    "AdjustmentType" : "QuantityChangeInCapacity",
    "InitialMaxSize" : 100,
    "EstimatedInstanceWarmup" : 300,
    "ScaleOutEvaluationCount" : 3,
    "PredictiveScalingMode" : "PredictAndScale",
    "MinAdjustmentMagnitude" : 1,
    "ScalingRuleAri" : "ari:acs:ess:cn-hangzhou:140692647406****:scalingrule/asr-bp1dvirgwkoowxk7****",
    "PredictiveTaskBufferTime" : 30,
    "MinSize" : 1,
    "ScalingGroupId" : "asg-bp1ffogfdauy0jw0****",
    "PredictiveValueBehavior" : "MaxOverridePredictiveValue",
    "TargetValue" : 0.125,
    "Cooldown" : 20,
    "MaxSize" : 2,
    "PredictiveValueBuffer" : 50,
    "ScalingRuleType" : "SimpleScalingRule",
    "AdjustmentValue" : 1,
    "ScaleInEvaluationCount" : 15,
    "DisableScaleIn" : true,
    "ScalingRuleName" : "scalingrule****",
    "ScalingRuleId" : "asr-bp1dvirgwkoowxk7****",
    "Alarms" : [ {
      "AlarmTaskId" : "asg-bp18p2yfxow2dloq****_1f9458d1-70e1-4bee-8c7f-7a47695b****",
      "ComparisonOperator" : ">=",
      "MetricName" : "CpuUtilization",
      "EvaluationCount" : 3,
      "AlarmTaskName" : "alarmtask****",
      "MetricType" : "system",
      "Threshold" : 50,
      "Statistics" : "Average",
      "Dimensions" : [ {
        "DimensionKey" : "scaling_group",
        "DimensionValue" : "asg-bp18p2yfxow2dloq****"
      } ]
    } ],
    "StepAdjustments" : [ {
      "MetricIntervalUpperBound" : 5,
      "ScalingAdjustment" : 1,
      "MetricIntervalLowerBound" : 1
    } ],
    "AlarmDimensions" : [ {
      "DimensionKey" : "rulePool",
      "DimensionValue" : "sgp-l1cbirz451yxu2****"
    } ]
  } ]
}

Error codes

For a list of error codes, see Service error codes.