Skip to content

ScalingRule

This class encapsulates and extends the ROS resource type ALIYUN::ESS::ScalingRule, which is used to create a scaling rule.

Initializers

import ros_cdk_ess
ros_cdk_ess.ScalingRule(
  scope: Construct,
  id: str,
  scaling_group_id: typing.Union[str, IResolvable],
  adjustment_type: typing.Union[str, IResolvable] = None,
  adjustment_value: typing.Union[typing.Union[int, float], IResolvable] = None,
  cooldown: typing.Union[typing.Union[int, float], IResolvable] = None,
  disable_scale_in: typing.Union[bool, IResolvable] = None,
  estimated_instance_warmup: typing.Union[typing.Union[int, float], IResolvable] = None,
  initial_max_size: typing.Union[typing.Union[int, float], IResolvable] = None,
  metric_name: typing.Union[str, IResolvable] = None,
  min_adjustment_magnitude: typing.Union[typing.Union[int, float], IResolvable] = None,
  predictive_scaling_mode: typing.Union[str, IResolvable] = None,
  predictive_task_buffer_time: typing.Union[typing.Union[int, float], IResolvable] = None,
  predictive_value_behavior: typing.Union[str, IResolvable] = None,
  predictive_value_buffer: typing.Union[typing.Union[int, float], IResolvable] = None,
  scale_in_evaluation_count: typing.Union[typing.Union[int, float], IResolvable] = None,
  scale_out_evaluation_count: typing.Union[typing.Union[int, float], IResolvable] = None,
  scaling_rule_name: typing.Union[str, IResolvable] = None,
  scaling_rule_type: typing.Union[str, IResolvable] = None,
  step_adjustment: typing.Union[IResolvable, typing.List[typing.Union[IResolvable, StepAdjustmentProperty]]] = None,
  target_value: typing.Union[typing.Union[int, float], IResolvable] = None,
  enable_resource_property_constraint: bool = None
)
Name Type Description
scope ros_cdk_core.Construct No description.
id str No description.
scaling_group_id typing.Union[str, ros_cdk_core.IResolvable] Property scalingGroupId: ID of the scaling group of a scaling rule.
adjustment_type typing.Union[str, ros_cdk_core.IResolvable] Property adjustmentType: Adjustment mode of a scaling rule.
adjustment_value typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property adjustmentValue: Adjusted value of a scaling rule.
cooldown typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property cooldown: Cool-down time of a scaling rule.
disable_scale_in typing.Union[bool, ros_cdk_core.IResolvable] Property disableScaleIn: Specifies whether to disable scale-in.
estimated_instance_warmup typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property estimatedInstanceWarmup: The warm-up period of the ECS instances.
initial_max_size typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property initialMaxSize: The maximum number of ECS instances in the scaling group, which is used together with PredictiveValueBehavior.
metric_name typing.Union[str, ros_cdk_core.IResolvable] Property metricName: The predefined metric to monitor.
min_adjustment_magnitude typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property minAdjustmentMagnitude: The minimum number of ECS instances to be adjusted in a scaling rule.
predictive_scaling_mode typing.Union[str, ros_cdk_core.IResolvable] Property predictiveScalingMode: The mode of the predictive scaling rule.
predictive_task_buffer_time typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property predictiveTaskBufferTime: The amount of buffer time ahead of the forecast task execution time.
predictive_value_behavior typing.Union[str, ros_cdk_core.IResolvable] Property predictiveValueBehavior: The action taken on the predicted maximum value.
predictive_value_buffer typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property predictiveValueBuffer: The ratio of the increment to the predicted value when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer.
scale_in_evaluation_count typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property scaleInEvaluationCount: The number of consecutive times that the event-triggered task created for scale-in activities meets the threshold conditions before an alert is triggered.
scale_out_evaluation_count typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property scaleOutEvaluationCount: The number of consecutive times that the event-triggered task created for scale-out activities meets the threshold conditions before an alert is triggered.
scaling_rule_name typing.Union[str, ros_cdk_core.IResolvable] Property scalingRuleName: Name shown for the scaling group, which is a string containing 2 to 40 English or Chinese characters.
scaling_rule_type typing.Union[str, ros_cdk_core.IResolvable] Property scalingRuleType: The type of the scaling rule.
step_adjustment typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, StepAdjustmentProperty]]] Property stepAdjustment:.
target_value typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable] Property targetValue: The target value of a metric.
enable_resource_property_constraint bool No description.

scopeRequired

  • Type: ros_cdk_core.Construct

idRequired

  • Type: str

scaling_group_idRequired

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property scalingGroupId: ID of the scaling group of a scaling rule.


adjustment_typeOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property adjustmentType: Adjustment mode of a scaling rule.

Optional values:

  • QuantityChangeInCapacity: It is used to increase or decrease a specified number of ECS instances.
  • PercentChangeInCapacity: It is used to increase or decrease a specified proportion of ECS instances.
  • TotalCapacity: It is used to adjust the quantity of ECS instances in the current scaling group to a specified value.

adjustment_valueOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property adjustmentValue: Adjusted value of a scaling rule.

Value range:

  • QuantityChangeInCapacity: [-500, 500]
  • PercentChangeInCapacity: [-100, 10000]
  • TotalCapacity: [0, 1000]

cooldownOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property cooldown: Cool-down time of a scaling rule.

Value range: [0, 86,400], in seconds. The default value is empty.


disable_scale_inOptional

  • Type: typing.Union[bool, ros_cdk_core.IResolvable]

Property disableScaleIn: Specifies whether to disable scale-in.

This parameter is applicable only to target tracking scaling rules. Default value: false


estimated_instance_warmupOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property estimatedInstanceWarmup: The warm-up period of the ECS instances.

This parameter is applicable to target tracking scaling rules and step scaling rules. The system adds ECS instances that are in the warm-up state to the scaling group, but does not report monitoring data during the warm-up period to CloudMonitor. Note: When calculating the number of ECS instances to be adjusted, the system does not count ECS instances in the warm-up state as part of the current capacity of the scaling group. Valid values: 0 to 86400. Unit: seconds. Default value: 300.


initial_max_sizeOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property initialMaxSize: The maximum number of ECS instances in the scaling group, which is used together with PredictiveValueBehavior.

Default value: the same as the value of MaxSize


metric_nameOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property metricName: The predefined metric to monitor.

This parameter is required and applicable only to target tracking scaling rules and predictive scaling rules. Valid values of a target tracking scaling rule:

  • CpuUtilization: the average CPU utilization- ClassicInternetRx: the average public network inbound traffic over the classic network
  • ClassicInternetTx: the average public network outbound traffic over the classic network
  • VpcInternetRx: the average public network inbound traffic over the VPC
  • VpcInternetTx: the average public network outbound traffic over the VPC
  • IntranetRx: the average internal network inbound traffic
  • IntranetTx: the average internal network outbound traffic Valid values of a predictive scaling rule:
  • CpuUtilization: the average CPU utilization
  • IntranetRx: the average internal network inbound traffic
  • IntranetTx: the average internal network outbound traffic

min_adjustment_magnitudeOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property minAdjustmentMagnitude: The minimum number of ECS instances to be adjusted in a scaling rule.

This parameter takes effect only when the scaling rule type is SimpleScalingRule or StepScalingRule and AdjustmentType is PercentChangeInCapacity.


predictive_scaling_modeOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property predictiveScalingMode: The mode of the predictive scaling rule.

Valid values:

  • PredictAndScale: generates forecasts and creates forecast tasks.
  • PredictOnly: generates forecasts but does not create forecast tasks. Default value: PredictAndScale

predictive_task_buffer_timeOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property predictiveTaskBufferTime: The amount of buffer time ahead of the forecast task execution time.

By default, all scheduled tasks that are automatically created for a predictive scaling rule are executed at the beginning of each hour. You can set a buffer time to execute forecast tasks ahead of schedule, so that resources can be prepared in advance. Valid values: 0 to 60. Unit: minutes. Default value: 0


predictive_value_behaviorOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property predictiveValueBehavior: The action taken on the predicted maximum value.

Valid values:

  • MaxOverridePredictiveValue: uses the initial maximum capacity as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.

  • PredictiveValueOverrideMax: uses the predicted value as the maximum value for forecast tasks when the predicted value is greater than the initial maximum capacity.

  • PredictiveValueOverrideMaxWithBuffer: increases the predicted value with a ratio, which is specified by PredictiveValueBuffer. If the value after the increase is greater than the initial maximum capacity, the value after the increase is used as the maximum value for forecast tasks. Default value: MaxOverridePredictiveValue

predictive_value_bufferOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property predictiveValueBuffer: The ratio of the increment to the predicted value when PredictiveValueBehavior is set to PredictiveValueOverrideMaxWithBuffer.

When the value after the increase is greater than the initial maximum capacity, the value after the increase is used for forecast tasks. Valid values: 0 to 100 Default value: 0


scale_in_evaluation_countOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property scaleInEvaluationCount: The number of consecutive times that the event-triggered task created for scale-in activities meets the threshold conditions before an alert is triggered.

After a target tracking scaling rule is created, an event-triggered task is automatically created and then associated with the target tracking scaling rule. Default value: 15.


scale_out_evaluation_countOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property scaleOutEvaluationCount: The number of consecutive times that the event-triggered task created for scale-out activities meets the threshold conditions before an alert is triggered.

After a target tracking scaling rule is created, an event-triggered task is automatically created and then associated with the target tracking scaling rule. Default value: 3.


scaling_rule_nameOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property scalingRuleName: 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.


scaling_rule_typeOptional

  • Type: typing.Union[str, ros_cdk_core.IResolvable]

Property scalingRuleType: The type of the scaling rule.

Valid values:

  • SimpleScalingRule: scales ECS instances based on the values of AdjustmentType and AdjustmentValue.
  • TargetTrackingScalingRule: dynamically calculates the number of ECS instances to be adjusted and tries to keep the value of a predefined monitoring metric close to TargetValue.
  • StepScalingRule: scales ECS instances in steps based on specified thresholds and metric values.
  • PredictiveScalingRule: uses machine learning to analyze historical monitoring data of the scaling group and then predicts the future values of monitored metrics, the rule then automatically creates scheduled tasks to set the boundary values for the scaling group. If this parameter value is not specified, the default value is SimpleScalingRule.

step_adjustmentOptional

  • Type: typing.Union[ros_cdk_core.IResolvable, typing.List[typing.Union[ros_cdk_core.IResolvable, StepAdjustmentProperty]]]

Property stepAdjustment:.


target_valueOptional

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

Property targetValue: The target value of a metric.

This parameter is required and applicable only to target tracking scaling rules and predictive scaling rules. The value of TargetValue must be greater than 0 and can have a maximum of three decimal places.


enable_resource_property_constraintOptional

  • Type: bool

Methods

Name Description
to_string Returns a string representation of this construct.
synthesize Allows this construct to emit artifacts into the cloud assembly during synthesis.
add_condition No description.
add_count No description.
add_dependency No description.
add_resource_desc No description.
apply_removal_policy No description.
get_att No description.
set_metadata No description.

to_string

def to_string() -> str

Returns a string representation of this construct.

synthesize

def synthesize(
  session: ISynthesisSession
) -> None

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

sessionRequired

  • Type: ros_cdk_core.ISynthesisSession

The synthesis session.


add_condition

def add_condition(
  condition: RosCondition
) -> None

conditionRequired

  • Type: ros_cdk_core.RosCondition

add_count

def add_count(
  count: typing.Union[typing.Union[int, float], IResolvable]
) -> None

countRequired

  • Type: typing.Union[typing.Union[int, float], ros_cdk_core.IResolvable]

add_dependency

def add_dependency(
  resource: Resource
) -> None

resourceRequired

  • Type: ros_cdk_core.Resource

add_resource_desc

def add_resource_desc(
  desc: str
) -> None

descRequired

  • Type: str

apply_removal_policy

def apply_removal_policy(
  policy: RemovalPolicy
) -> None

policyRequired

  • Type: ros_cdk_core.RemovalPolicy

get_att

def get_att(
  name: str
) -> IResolvable

nameRequired

  • Type: str

set_metadata

def set_metadata(
  key: str,
  value: typing.Any
) -> None

keyRequired

  • Type: str

valueRequired

  • Type: typing.Any

Static Functions

Name Description
is_construct Return whether the given object is a Construct.

is_construct

import ros_cdk_ess
ros_cdk_ess.ScalingRule.is_construct(
  x: typing.Any
)

Return whether the given object is a Construct.

xRequired

  • Type: typing.Any

Properties

Name Type Description
node ros_cdk_core.ConstructNode The construct tree node associated with this construct.
ref str No description.
stack ros_cdk_core.Stack The stack in which this resource is defined.
resource ros_cdk_core.RosResource No description.
attr_scaling_rule_ari ros_cdk_core.IResolvable Attribute ScalingRuleAri: Unique identifier of a scaling rule.
attr_scaling_rule_id ros_cdk_core.IResolvable Attribute ScalingRuleId: ID of a scaling rule, generated by the system and globally unique.

nodeRequired

node: ConstructNode
  • Type: ros_cdk_core.ConstructNode

The construct tree node associated with this construct.


refRequired

ref: str
  • Type: str

stackRequired

stack: Stack
  • Type: ros_cdk_core.Stack

The stack in which this resource is defined.


resourceOptional

resource: RosResource
  • Type: ros_cdk_core.RosResource

attr_scaling_rule_ariRequired

attr_scaling_rule_ari: IResolvable
  • Type: ros_cdk_core.IResolvable

Attribute ScalingRuleAri: Unique identifier of a scaling rule.


attr_scaling_rule_idRequired

attr_scaling_rule_id: IResolvable
  • Type: ros_cdk_core.IResolvable

Attribute ScalingRuleId: ID of a scaling rule, generated by the system and globally unique.