All Products
Search
Document Center

Auto Scaling:DescribeScalingRules

Last Updated:Jul 09, 2024

Queries scaling rules. When you call this operation, you can specify the ID, name, or Alibaba Cloud Resource Name (ARN) of a scaling rule to query the details of the scaling rule. For example, you can query the adjustment method, instance warm-up period, and associated event-triggered tasks of the desired scaling rule.

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

DescribeScalingRules

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

RegionId

String

Yes

cn-qingdao

The region ID of the scaling group.

PageNumber

Integer

No

1

The page number. Pages start from page 1.

Default value: 1.

PageSize

Integer

No

50

The number of entries per page. Valid values: 1 to 50.

Default value: 10.

ScalingGroupId

String

No

asg-bp1ffogfdauy0jw0****

The ID of the scaling group.

ScalingRuleType

String

No

SimpleScalingRule

The type of the scaling rule. Valid values:

  • SimpleScalingRule: a simple scaling rule. Once a simple scaling rule is executed, Auto Scaling adjusts the number of ECS instances or elastic container instances in the scaling group based on the values of AdjustmentType and AdjustmentValue.

  • TargetTrackingScalingRule: a target tracking scaling rule. Once a target tracking scaling rule is executed, Auto Scaling dynamically calculates the number of ECS instances or elastic container instances to scale based on the predefined metric (MetricName) and attempts to maintain the metric value close to the specified target value (TargetValue).

  • StepScalingRule: a step scaling rule. Once a step scaling rule is executed, Auto Scaling scales instances step by step based on the predefined thresholds and metric values.

  • PredictiveScalingRule: a predictive scaling rule. Once a predictive scaling rule is executed, Auto Scaling analyzes the historical monitoring data based on the machine learning technology and predicts the trends of metric data. Auto Scaling also creates scheduled tasks to enable dynamic adjustment of the boundary values for the scaling group.

ShowAlarmRules

Boolean

No

false

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

  • true

  • false

Default value: false.

ScalingRuleId.N

String

No

asr-bp1dvirgwkoowxk7****

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

ScalingRuleName.N

String

No

scalingrule****

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

ScalingRuleAri.N

String

No

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

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

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

The request ID.

PageNumber

Integer

1

The page number.

PageSize

Integer

50

The number of entries per page.

TotalCount

Integer

1

The total number of scaling rules.

ScalingRules

Array of ScalingRule

The scaling rules.

ScalingRule

MetricName

String

CpuUtilization

The predefined metric of the scaling rule. This parameter is applicable if ScalingRuleType is set to TargetTrackingScalingRule or PredictiveScalingRule.

Valid values if ScalingRuleType is set to TargetTrackingScalingRule:

  • CpuUtilization: the average CPU utilization

  • ClassicInternetRx: the average inbound public traffic over the classic network

  • ClassicInternetTx: the average outbound public traffic over the classic network

  • VpcInternetRx: the average inbound public traffic over a virtual private cloud (VPC)

  • VpcInternetTx: the average outbound public 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

AdjustmentType

String

QuantityChangeInCapacity

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.

InitialMaxSize

Integer

100

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

EstimatedInstanceWarmup

Integer

300

The warm-up period during which a series of preparation measures are taken on new instances. Auto Scaling does not monitor the metric data of instances that are being warmed up.

ScaleOutEvaluationCount

Integer

3

The number of consecutive times that the event-triggered task created for scale-out purposes 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.

PredictiveScalingMode

String

PredictAndScale

The mode of the predictive scaling rule. Valid values:

  • PredictAndScale: produces predictions and creates prediction tasks.

  • PredictOnly: provides predictions but does not create prediction tasks.

MinAdjustmentMagnitude

Integer

1

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

ScalingRuleAri

String

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

The ARN of scaling rule N.

PredictiveTaskBufferTime

Integer

30

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

MinSize

Integer

1

The minimum number of ECS instances that must be contained in the scaling group.

ScalingGroupId

String

asg-bp1ffogfdauy0jw0****

The ID of the scaling group.

PredictiveValueBehavior

String

MaxOverridePredictiveValue

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.

TargetValue

Float

0.125

The target value of the metric. If you set TargetValue to TargetTrackingScalingRule or PredictiveScalingRule, Auto Scaling adds instances to or removes instances from the scaling group to maintain the target metric value.

Cooldown

Integer

20

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.

MaxSize

Integer

2

The maximum number of ECS instances that can be contained in the scaling group.

PredictiveValueBuffer

Integer

50

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.

ScalingRuleType

String

SimpleScalingRule

The type of the scaling rule. Valid values:

  • SimpleScalingRule: a simple scaling rule. Once a simple scaling rule is executed, Auto Scaling adjusts the number of ECS instances or elastic container instances in the scaling group based on the values of AdjustmentType and AdjustmentValue.

  • TargetTrackingScalingRule: a target tracking scaling rule. Once a target tracking scaling rule is executed, Auto Scaling dynamically calculates the number of ECS instances or elastic container instances to scale based on the predefined metric (MetricName) and attempts to maintain the metric value close to the specified target value (TargetValue).

  • StepScalingRule: a step scaling rule. Once a step scaling rule is executed, Auto Scaling scales instances step by step based on the predefined thresholds and metric values.

  • PredictiveScalingRule: a predictive scaling rule. Once a predictive scaling rule is executed, Auto Scaling analyzes the historical monitoring data based on the machine learning technology and predicts the trends of metric data. Auto Scaling also creates scheduled tasks to enable dynamic adjustment of the boundary values for the scaling group.

AdjustmentValue

Integer

1

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

ScaleInEvaluationCount

Integer

15

The number of consecutive times that the event-triggered task for scale-in purposes 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.

DisableScaleIn

Boolean

true

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

  • true

  • false

ScalingRuleName

String

scalingrule****

The name of the scaling rule.

ScalingRuleId

String

asr-bp1dvirgwkoowxk7****

The ID of the scaling rule.

Alarms

Array 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

AlarmTaskId

String

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

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

ComparisonOperator

String

>=

The comparison operator between the statistical value and the threshold of the metric of 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: <.

MetricName

String

CpuUtilization

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

EvaluationCount

Integer

3

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

AlarmTaskName

String

alarmtask****

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

MetricType

String

system

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

  • system: event-triggered tasks of the system monitoring type

  • custom: event-triggered tasks of the custom monitoring type

Threshold

Float

50

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

Statistics

String

Average

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

  • Average

  • Maximum

  • Minimum

Dimensions

Array of Dimension

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

Dimension

DimensionKey

String

scaling_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

DimensionValue

String

asg-bp18p2yfxow2dloq****

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

StepAdjustments

Array of StepAdjustment

The step adjustments of the step scaling rule.

StepAdjustment

MetricIntervalUpperBound

Float

5.0

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

ScalingAdjustment

Integer

1

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

MetricIntervalLowerBound

Float

1.0

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

AlarmDimensions

Array 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

DimensionKey

String

rulePool

The dimension key of the metric.

DimensionValue

String

sgp-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.