ALIYUN::ESS::ScalingRule类型用于创建伸缩规则。

语法

{
  "Type": "ALIYUN::ESS::ScalingRule",
  "Properties": {
    "AdjustmentValue": Integer,
    "Cooldown": Integer,
    "ScalingGroupId": String,
    "AdjustmentType": String,
    "ScalingRuleName": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
AdjustmentValue Integer

伸缩规则的调整值。

任何情况下,单次调整的ECS实例台数都不能超过500。

不同调整方式对应的取值范围:
  • QuantityChangeInCapacity:[-500, 500]
  • PercentChangeInCapacity:[-100, 10000]
  • TotalCapacity:[0, 1000]
Cooldown Integer 伸缩规则的冷却时间。

取值范围:[0, 86400],单位:秒。

默认值为:空。

ScalingGroupId String 伸缩规则所属的伸缩组ID。
AdjustmentType String 伸缩规则的调整方式。 可选值:
  • QuantityChangeInCapacity:增加或减少指定数量的ECS实例。
  • PercentChangeInCapacity:增加或减少指定比例的ECS实例。
  • TotalCapacity: 将当前伸缩组的ECS实例数量调整到指定数量。
ScalingRuleName String 伸缩规则的显示名称。

2-40 个英文或中文字符,以数字、大小字母或中文开头,可包含数字,“_”、“-”或“.”。同一用户账号同一地域同一伸缩组内唯一。

如果没有指定该参数,默认值为ScalingRuleId。

返回值

Fn::GetAtt

  • ScalingRuleAri:伸缩规则的唯一标识符。
  • ScalingRuleId:伸缩规则的ID,由系统生成,全局唯一。

示例

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Resources": {
    "ScalingRule": {
      "Type": "ALIYUN::ESS::ScalingRule",
      "Properties": {
        "ScalingRuleName": {
          "Ref": "ScalingRuleName"
        },
        "Cooldown": {
          "Ref": "Cooldown"
        },
        "ScalingGroupId": {
          "Ref": "ScalingGroupId"
        },
        "AdjustmentType": {
          "Ref": "AdjustmentType"
        },
        "AdjustmentValue": {
          "Ref": "AdjustmentValue"
        }
      }
    }
  },
  "Parameters": {
    "ScalingRuleName": {
      "AllowedPattern": "^[a-zA-Z0-9\\u4e00-\\u9fa5][-_.a-zA-Z0-9\\u4e00-\\u9fa5]{1,63}$",
      "Type": "String",
      "Description": "Name shown for the scaling group, which is a string containing 2 to 40 English or Chinese characters. It must begin with a number, a letter (case-insensitive) or a Chinese character and can contain numbers, \"_\", \"-\" or \".\". The account name in the same scaling group is unique in the same region. If this parameter value is not specified, the default value is ScalingRuleId."
    },
    "Cooldown": {
      "Type": "Number",
      "Description": "Cool-down time of a scaling rule. Value range: [0, 86,400], in seconds. The default value is empty.",
      "MaxValue": 86400,
      "MinValue": 0
    },
    "ScalingGroupId": {
      "Type": "String",
      "Description": "ID of the scaling group of a scaling rule."
    },
    "AdjustmentType": {
      "Type": "String",
      "Description": "Adjustment mode of a scaling rule. Optional values:\n- QuantityChangeInCapacity: It is used to increase or decrease a specified number of ECS instances.\n- PercentChangeInCapacity: It is used to increase or decrease a specified proportion of ECS instances.\n- TotalCapacity: It is used to adjust the quantity of ECS instances in the current scaling group to a specified value.",
      "AllowedValues": [
        "QuantityChangeInCapacity",
        "PercentChangeInCapacity",
        "TotalCapacity"
      ]
    },
    "AdjustmentValue": {
      "Type": "Number",
      "Description": "Adjusted value of a scaling rule. Value range:\n- QuantityChangeInCapacity: [-500, 500]\n- PercentChangeInCapacity: [-100, 10000]\n- TotalCapacity: [0, 1000]",
      "MaxValue": 10000,
      "MinValue": -500
    }
  },
  "Outputs": {
    "ScalingRuleAri": {
      "Description": "Unique identifier of a scaling rule.",
      "Value": {
        "Fn::GetAtt": [
          "ScalingRule",
          "ScalingRuleAri"
        ]
      }
    },
    "ScalingRuleId": {
      "Description": "ID of a scaling rule, generated by the system and globally unique.",
      "Value": {
        "Fn::GetAtt": [
          "ScalingRule",
          "ScalingRuleId"
        ]
      }
    }
  }
}