ALIYUN::ESS::ScalingRule

更新时间:
复制 MD 格式

Creates a scaling rule for Auto Scaling (ESS).

Syntax

{
  "Type": "ALIYUN::ESS::ScalingRule",
  "Properties": {
    "AdjustmentValue": Integer,
    "Cooldown": Integer,
    "ScalingGroupId": String,
    "AdjustmentType": String,
    "ScalingRuleName": String,
    "MetricName": String,
    "PredictiveTaskBufferTime": Integer,
    "ScalingRuleType": String,
    "PredictiveValueBuffer": Integer,
    "TargetValue": Number,
    "StepAdjustment": List,
    "PredictiveValueBehavior": String,
    "DisableScaleIn": Boolean,
    "InitialMaxSize": Integer,
    "MinAdjustmentMagnitude": Integer,
    "EstimatedInstanceWarmup": Integer,
    "PredictiveScalingMode": String,
    "ScaleInEvaluationCount": Integer,
    "ScaleOutEvaluationCount": Integer
  }
}

Properties

Property name Type Required Update allowed Description Constraints
AdjustmentValue Integer No Yes

The adjustment value. Applies to simple scaling rules and step scaling rules.

Valid values vary based on AdjustmentType:
  • QuantityChangeInCapacity: -500 to 500.
  • PercentChangeInCapacity: -100 to 10,000.
  • TotalCapacity: 0 to 1,000.
Note The number of ECS instances that are adjusted in a single scaling activity cannot exceed 500.
Cooldown Integer No Yes The cooldown time. Applies only to simple scaling rules. Valid values: 0 to 86400.

Unit: seconds.

The default value is empty.

ScalingGroupId String Yes No The ID of the scaling group to which the scaling rule belongs. None
AdjustmentType String No Yes The adjustment method. Applies to simple scaling rules and step scaling rules. Valid values:
  • QuantityChangeInCapacity: Adds or removes a specified number of ECS instances.
  • PercentChangeInCapacity: Adds or removes a specified percentage of ECS instances.
  • TotalCapacity: Adjusts the number of ECS instances in the current scaling group to a specified number.
ScalingRuleName String No Yes The name of the scaling rule. The name must be 2 to 64 characters in length. It can contain letters, digits, underscores (_), hyphens (-), and periods (.). The name must start with a letter or a digit.

If you do not specify this parameter, the value of ScalingRuleId is used by default.

MetricName String No No The predefined metric. Applies to target tracking scaling rules and predictive scaling rules. Valid values:
  • For target tracking scaling rules:
    • 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 private network traffic.
    • IntranetTx: The average outbound private network traffic.
  • For predictive scaling rules:
    • CpuUtilization: The average CPU utilization.
    • IntranetRx: The average inbound private network traffic.
    • IntranetTx: The average outbound private network traffic.
PredictiveTaskBufferTime Integer No No A predictive scaling rule automatically creates a predictive task that runs on the hour. Set a buffer time to run the task in advance and prepare resources. Valid values: 0 to 60.

Unit: minutes.

Default value: 0.
ScalingRuleType String No No The type of the scaling rule. Valid values:
  • SimpleScalingRule (default): A simple scaling rule. Adjusts the number of ECS instances based on AdjustmentType and AdjustmentValue.
  • TargetTrackingScalingRule: A target tracking scaling rule. Dynamically calculates the number of ECS instances to scale based on a predefined metric (MetricName). This rule tries to keep the metric value close to the target value (TargetValue).
  • StepScalingRule: A step scaling rule. Provides a stepped scaling method based on thresholds and metric values.
  • PredictiveScalingRule: A predictive scaling rule. Uses machine learning to analyze historical monitoring data of the scaling group and predict future metric values. This rule also supports automatically creating scheduled tasks to set the boundaries of the scaling group.
PredictiveValueBuffer Integer No No The percentage by which the predicted value is increased. Takes effect only when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer. If the increased value is greater than the initial maximum value, the increased value is used. Valid values: 0 to 100.

Default value: 0.

TargetValue Number No No The target value. Applies to target tracking scaling rules and predictive scaling rules. The value of TargetValue can have up to three decimal places and must be greater than 0.
StepAdjustment List No No Procedure For more information, see StepAdjustment properties.
PredictiveValueBehavior String No No The action to take on the maximum value for a predictive scaling rule. Valid values:
  • MaxOverridePredictiveValue (default): The initial maximum value overwrites the predicted value. If the predicted value is greater than the initial maximum value, the initial maximum value is used for the predictive task.
  • PredictiveValueOverrideMax: The predicted value overwrites the initial maximum value. If the predicted value is greater than the initial maximum value, the predicted value is used for the predictive task.
  • PredictiveValueOverrideMaxWithBuffer: The predicted value is increased by a specified percentage. The predicted value is increased by the percentage specified by PredictiveValueBuffer. If the increased value is greater than the initial maximum value, the increased value is used.
DisableScaleIn Boolean No No Specifies whether to disable scale-in. Applies only to target tracking scaling rules. Valid values:
  • true
  • false (default)
InitialMaxSize Integer No No The maximum number of instances in the scaling group. Used with PredictiveValueBehavior. The default value is the maximum number of instances (MaxSize) of the scaling group.
MinAdjustmentMagnitude Integer No No The minimum number of instances to adjust. This parameter takes effect only when ScalingRuleType is SimpleScalingRule or StepScalingRule and AdjustmentType is PercentChangeInCapacity.
EstimatedInstanceWarmup Integer No No The warm-up period for newly added instances. Applies to target tracking scaling rules and step scaling rules. Valid values: 0 to 86,400.

Unit: seconds.

Default value: 300.

An ECS instance in the ramp-up state is added to the scaling group as usual, but its monitoring data is not reported to CloudMonitor during this period.

Note When the number of ECS instances to be scaled is dynamically calculated, instances in the ramp-up state are not counted as part of the current number of instances.
PredictiveScalingMode String No No The mode of the predictive scaling rule. Valid values:
  • PredictAndScale (default): Generates prediction results and creates predictive tasks.
  • PredictOnly: Generates prediction results but does not create predictive tasks.
ScaleInEvaluationCount Integer No Yes The number of consecutive times the threshold must be met before a scale-in event-triggered task is triggered. After you create a target tracking scaling rule, an event-triggered task is automatically created.

Default value: 15.

ScaleOutEvaluationCount Integer No Yes The number of consecutive times the threshold must be met before a scale-out event-triggered task is triggered. After you create a target tracking scaling rule, an event-triggered task is automatically created.

Default value: 3.

StepAdjustment syntax

"StepAdjustment": [
  {
    "MetricIntervalUpperBound": Number,
    "ScalingAdjustment": Integer,
    "MetricIntervalLowerBound": Number
  }
]

StepAdjustment properties

Property Name Type Required Update allowed Description Constraints
MetricIntervalUpperBound Number No No The upper bound of the step. Applies only to step scaling rules. Valid values: -9.999999E18 to 9.999999E18.
ScalingAdjustment Integer No No The number of instances to add in the step. Applies only to step scaling rules. None
MetricIntervalLowerBound Number No No The lower bound of the step. Applies only to step scaling rules. Valid values: -9.999999E18 to 9.999999E18.

Return values

Fn::GetAtt

  • ScalingRuleAri: The unique identifier of the scaling rule.
  • ScalingRuleId: The system-generated, globally unique ID of the scaling rule.

Examples

  • YAML format

    ROSTemplateFormatVersion: '2015-09-01'
    Description: Test ESS ScalingRule
    Parameters:
      AutoScalingGroupId:
        Type: String
        AssociationProperty: ALIYUN::ESS::AutoScalingGroup::AutoScalingGroupId
    Resources:
      ScalingRule:
        Type: ALIYUN::ESS::ScalingRule
        Properties:
          AdjustmentType: QuantityChangeInCapacity
          ScalingGroupId:
            Ref: AutoScalingGroupId
          AdjustmentValue: 1
    Outputs: {}
  • JSON format

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Description": "Test ESS ScalingRule",
      "Parameters": {
        "AutoScalingGroupId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ESS::AutoScalingGroup::AutoScalingGroupId"
        }
      },
      "Resources": {
        "ScalingRule": {
          "Type": "ALIYUN::ESS::ScalingRule",
          "Properties": {
            "AdjustmentType": "QuantityChangeInCapacity",
            "ScalingGroupId": {
              "Ref": "AutoScalingGroupId"
            },
            "AdjustmentValue": 1
          }
        }
      },
      "Outputs": {
      }
    }