All Products
Search
Document Center

Auto Scaling:DescribeScalingRules

Last Updated:Nov 11, 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.

Operation description

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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ess:DescribeScalingRulesget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the scaling group to which the scaling rules that you want to query belong.

cn-qingdao
PageNumberintegerNo

The page number. Pages start from page 1.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page. Maximum value: 50.

Default value: 10.

50
ScalingGroupIdstringNo

The ID of the scaling group.

asg-bp1ffogfdauy0jw0****
ScalingRuleTypestringNo

The type of the scaling rule. Valid values:

  • SimpleScalingRule: adjusts the number of ECS instances based on the values of the AdjustmentType and AdjustmentValue parameters.
  • TargetTrackingScalingRule: calculates the number of ECS instances that need to be scaled in a dynamic manner and maintains the value of a predefined metric close to the value of the TargetValue parameter.
  • 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 automatically creates scheduled tasks to adjust the boundary values for the scaling group.
SimpleScalingRule
ShowAlarmRulesbooleanNo

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

  • true
  • false

Default value: false.

false
ScalingRuleIdsarrayNo

The IDs of the scaling rules that you want to query.

stringNo

The IDs of the scaling rules that you want to query.

asr-bp1dvirgwkoowxk7****
ScalingRuleNamesarrayNo

The names of the scaling rules that you want to query.

stringNo

The names of the scaling rules that you want to query.

scalingrule****
ScalingRuleArisarrayNo

The unique identifiers of the scaling rules that you want to query.

stringNo

The unique identifiers of the scaling rules that you want to query.

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

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

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

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

50
TotalCountinteger

The total number of scaling rules.

1
ScalingRulesarray<object>

The scaling rules.

ScalingRuleobject

The scaling rule.

MetricNamestring

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

CpuUtilization
AdjustmentTypestring

The adjustment method of the scaling rule. Valid values:

  • QuantityChangeInCapacity: adds or removes the specified number of Elastic Compute Service (ECS) instances to or from the scaling group.
  • PercentChangeInCapacity: adds or removes the specified percentage of ECS instances to or from the scaling group.
  • TotalCapacity: adjusts the number of ECS instances in the scaling group to the specified number.
QuantityChangeInCapacity
InitialMaxSizeinteger

The maximum number of ECS instances that can be contained in the scaling group. If you specify this parameter, you must also specify PredictiveValueBehavior.

100
EstimatedInstanceWarmupinteger

The warm-up period of instances. During the warm-up period, a series of preparation measures are taken for the new instances. Performance metrics of instances being warmed up are not counted towards the monitoring range.

300
ScaleOutEvaluationCountinteger

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.

3
PredictiveScalingModestring

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.
PredictAndScale
MinAdjustmentMagnitudeinteger

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

1
ScalingRuleAristring

The unique identifier of the scaling rule.

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

The amount of buffer time before prediction tasks are executed. By default, all prediction tasks that are automatically created based on a predictive scaling rule are executed on the hour. You can specify a buffer time for resource preparation before prediction tasks are executed. Valid values: 0 to 60. Unit: minutes.

30
MinSizeinteger

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

1
ScalingGroupIdstring

The ID of the scaling group.

asg-bp1ffogfdauy0jw0****
PredictiveValueBehaviorstring

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 when 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 this ratio is greater than the initial maximum capacity.
MaxOverridePredictiveValue
TargetValuefloat

The target value of the metric. If you set ScalingRuleType to TargetTrackingScalingRule or PredictiveScalingRule, Auto Scaling keeps the metric value close to the target value by adding instances to or removing instances from the scaling group.

0.125
Cooldowninteger

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.

20
MaxSizeinteger

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

2
PredictiveValueBufferinteger

The ratio based on which the predicted value is increased when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer. If the predicted value 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.

50
ScalingRuleTypestring

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 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.
SimpleScalingRule
AdjustmentValueinteger

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

1
ScaleInEvaluationCountinteger

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.

15
DisableScaleInboolean

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

  • true
  • false
true
ScalingRuleNamestring

The name of the scaling rule.

scalingrule****
ScalingRuleIdstring

The ID of the scaling rule.

asr-bp1dvirgwkoowxk7****
Alarmsarray<object>

The event-triggered tasks that are associated with the scaling rule. The value of this parameter is returned only if you set ShowAlarmRules to true. Otherwise, null is returned.

Alarmobject

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

AlarmTaskIdstring

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

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

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 threshold: >=
  • Valid value if the metric value is less than or equal to the threshold: <=
  • Valid value if the metric value is greater than the threshold: >
  • Valid value if the metric value is less than the threshold: <
>=
MetricNamestring

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

CpuUtilization
EvaluationCountinteger

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

3
AlarmTaskNamestring

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

alarmtask****
MetricTypestring

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

  • system: system metrics
  • custom: custom metrics
system
Thresholdfloat

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

50
Statisticsstring

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

  • Average
  • Maximum
  • Minimum
Average
Dimensionsarray<object>

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

Dimensionobject

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

DimensionKeystring

The key of the dimension that is associated with the metric. Valid values:

  • ScalingGroupId: the ID of the scaling group.
  • userId: the ID of the user account.
scaling_group
DimensionValuestring

The value of the dimension that is associated with the metric.

asg-bp18p2yfxow2dloq****
StepAdjustmentsarray<object>

The step adjustments of the step scaling rule.

StepAdjustmentobject

The step adjustments of the step scaling rule.

MetricIntervalUpperBoundfloat

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

5.0
ScalingAdjustmentinteger

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

1
MetricIntervalLowerBoundfloat

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

1.0
AlarmDimensionsarray<object>

The dimensions. This parameter is applicable to target tracking scaling rules. You can specify this parameter if your predefined metric requires extra dimensions. For example, if you predefine the LoadBalancerRealServerAverageQps metric, you must use this parameter to specify the rulePool dimension.

AlarmDimensionobject
DimensionKeystring

The dimension key of the metric.

rulePool
DimensionValuestring

The dimension value of the metric.

sgp-l1cbirz451yxu2dxxx

Examples

Sample success responses

JSONformat

{
  "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-l1cbirz451yxu2dxxx"
        }
      ],
      "MetricType": "",
      "HybridMonitorNamespace": "",
      "HybridMetrics": [
        {
          "Id": "",
          "Expression": "",
          "MetricName": "",
          "Statistic": "",
          "Dimensions": [
            {
              "DimensionKey": "",
              "DimensionValue": ""
            }
          ]
        }
      ]
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-13The response structure of the API has changedView Change Details
2023-04-03The response structure of the API has changedView Change Details