CfnScalingPolicyProps

class aws_cdk.aws_autoscaling.CfnScalingPolicyProps(*, auto_scaling_group_name, adjustment_type=None, cooldown=None, estimated_instance_warmup=None, metric_aggregation_type=None, min_adjustment_magnitude=None, policy_type=None, predictive_scaling_configuration=None, scaling_adjustment=None, step_adjustments=None, target_tracking_configuration=None)

Bases: object

Properties for defining a CfnScalingPolicy.

Parameters:
  • auto_scaling_group_name (str) – The name of the Auto Scaling group.

  • adjustment_type (Optional[str]) – Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity . Required if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .

  • cooldown (Optional[str]) – A cooldown period, in seconds, that applies to a specific simple scaling policy. When a cooldown period is specified here, it overrides the default cooldown. Valid only if the policy type is SimpleScaling . For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide . Default: None

  • estimated_instance_warmup (Union[int, float, None]) – Not needed if the default instance warmup is defined for the group.. The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup. Valid only if the policy type is TargetTrackingScaling or StepScaling . .. epigraph:: The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then EstimatedInstanceWarmup falls back to the value of default cooldown.

  • metric_aggregation_type (Optional[str]) – The aggregation type for the CloudWatch metrics. The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average . Valid only if the policy type is StepScaling .

  • min_adjustment_magnitude (Union[int, float, None]) –

    The minimum value to scale by when the adjustment type is PercentChangeInCapacity . For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. Valid only if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide . .. epigraph:: Some Auto Scaling groups use instance weights. In this case, set the MinAdjustmentMagnitude to a value that is at least as large as your largest instance weight.

  • policy_type (Optional[str]) – One of the following policy types:. - TargetTrackingScaling - StepScaling - SimpleScaling (default) - PredictiveScaling

  • predictive_scaling_configuration (Union[IResolvable, PredictiveScalingConfigurationProperty, Dict[str, Any], None]) – A predictive scaling policy. Provides support for predefined and custom metrics. Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count. Required if the policy type is PredictiveScaling .

  • scaling_adjustment (Union[int, float, None]) – The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value. Required if the policy type is SimpleScaling . (Not used with any other policy type.)

  • step_adjustments (Union[IResolvable, Sequence[Union[IResolvable, StepAdjustmentProperty, Dict[str, Any]]], None]) – A set of adjustments that enable you to scale based on the size of the alarm breach. Required if the policy type is StepScaling . (Not used with any other policy type.)

  • target_tracking_configuration (Union[IResolvable, TargetTrackingConfigurationProperty, Dict[str, Any], None]) – A target tracking scaling policy. Provides support for predefined or custom metrics. The following predefined metrics are available: - ASGAverageCPUUtilization - ASGAverageNetworkIn - ASGAverageNetworkOut - ALBRequestCountPerTarget If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel property with the PredefinedMetricSpecification . Required if the policy type is TargetTrackingScaling .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_autoscaling as autoscaling

cfn_scaling_policy_props = autoscaling.CfnScalingPolicyProps(
    auto_scaling_group_name="autoScalingGroupName",

    # the properties below are optional
    adjustment_type="adjustmentType",
    cooldown="cooldown",
    estimated_instance_warmup=123,
    metric_aggregation_type="metricAggregationType",
    min_adjustment_magnitude=123,
    policy_type="policyType",
    predictive_scaling_configuration=autoscaling.CfnScalingPolicy.PredictiveScalingConfigurationProperty(
        metric_specifications=[autoscaling.CfnScalingPolicy.PredictiveScalingMetricSpecificationProperty(
            target_value=123,

            # the properties below are optional
            customized_capacity_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedCapacityMetricProperty(
                metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty(
                    id="id",

                    # the properties below are optional
                    expression="expression",
                    label="label",
                    metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty(
                        metric=autoscaling.CfnScalingPolicy.MetricProperty(
                            metric_name="metricName",
                            namespace="namespace",

                            # the properties below are optional
                            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                                name="name",
                                value="value"
                            )]
                        ),
                        stat="stat",

                        # the properties below are optional
                        unit="unit"
                    ),
                    return_data=False
                )]
            ),
            customized_load_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedLoadMetricProperty(
                metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty(
                    id="id",

                    # the properties below are optional
                    expression="expression",
                    label="label",
                    metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty(
                        metric=autoscaling.CfnScalingPolicy.MetricProperty(
                            metric_name="metricName",
                            namespace="namespace",

                            # the properties below are optional
                            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                                name="name",
                                value="value"
                            )]
                        ),
                        stat="stat",

                        # the properties below are optional
                        unit="unit"
                    ),
                    return_data=False
                )]
            ),
            customized_scaling_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingCustomizedScalingMetricProperty(
                metric_data_queries=[autoscaling.CfnScalingPolicy.MetricDataQueryProperty(
                    id="id",

                    # the properties below are optional
                    expression="expression",
                    label="label",
                    metric_stat=autoscaling.CfnScalingPolicy.MetricStatProperty(
                        metric=autoscaling.CfnScalingPolicy.MetricProperty(
                            metric_name="metricName",
                            namespace="namespace",

                            # the properties below are optional
                            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                                name="name",
                                value="value"
                            )]
                        ),
                        stat="stat",

                        # the properties below are optional
                        unit="unit"
                    ),
                    return_data=False
                )]
            ),
            predefined_load_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedLoadMetricProperty(
                predefined_metric_type="predefinedMetricType",

                # the properties below are optional
                resource_label="resourceLabel"
            ),
            predefined_metric_pair_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedMetricPairProperty(
                predefined_metric_type="predefinedMetricType",

                # the properties below are optional
                resource_label="resourceLabel"
            ),
            predefined_scaling_metric_specification=autoscaling.CfnScalingPolicy.PredictiveScalingPredefinedScalingMetricProperty(
                predefined_metric_type="predefinedMetricType",

                # the properties below are optional
                resource_label="resourceLabel"
            )
        )],

        # the properties below are optional
        max_capacity_breach_behavior="maxCapacityBreachBehavior",
        max_capacity_buffer=123,
        mode="mode",
        scheduling_buffer_time=123
    ),
    scaling_adjustment=123,
    step_adjustments=[autoscaling.CfnScalingPolicy.StepAdjustmentProperty(
        scaling_adjustment=123,

        # the properties below are optional
        metric_interval_lower_bound=123,
        metric_interval_upper_bound=123
    )],
    target_tracking_configuration=autoscaling.CfnScalingPolicy.TargetTrackingConfigurationProperty(
        target_value=123,

        # the properties below are optional
        customized_metric_specification=autoscaling.CfnScalingPolicy.CustomizedMetricSpecificationProperty(
            metric_name="metricName",
            namespace="namespace",
            statistic="statistic",

            # the properties below are optional
            dimensions=[autoscaling.CfnScalingPolicy.MetricDimensionProperty(
                name="name",
                value="value"
            )],
            unit="unit"
        ),
        disable_scale_in=False,
        predefined_metric_specification=autoscaling.CfnScalingPolicy.PredefinedMetricSpecificationProperty(
            predefined_metric_type="predefinedMetricType",

            # the properties below are optional
            resource_label="resourceLabel"
        )
    )
)

Attributes

adjustment_type

Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage).

The valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .

Required if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-adjustmenttype

auto_scaling_group_name

The name of the Auto Scaling group.

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-autoscalinggroupname

cooldown

A cooldown period, in seconds, that applies to a specific simple scaling policy.

When a cooldown period is specified here, it overrides the default cooldown.

Valid only if the policy type is SimpleScaling . For more information, see Scaling cooldowns for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .

Default: None

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-cooldown

estimated_instance_warmup

Not needed if the default instance warmup is defined for the group..

The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup.

Valid only if the policy type is TargetTrackingScaling or StepScaling . .. epigraph:

The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then ``EstimatedInstanceWarmup`` falls back to the value of default cooldown.
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-estimatedinstancewarmup

metric_aggregation_type

The aggregation type for the CloudWatch metrics.

The valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .

Valid only if the policy type is StepScaling .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-metricaggregationtype

min_adjustment_magnitude

The minimum value to scale by when the adjustment type is PercentChangeInCapacity .

For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a MinAdjustmentMagnitude of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a MinAdjustmentMagnitude of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances.

Valid only if the policy type is StepScaling or SimpleScaling . For more information, see Scaling adjustment types in the Amazon EC2 Auto Scaling User Guide . .. epigraph:

Some Auto Scaling groups use instance weights. In this case, set the ``MinAdjustmentMagnitude`` to a value that is at least as large as your largest instance weight.
Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-minadjustmentmagnitude

policy_type

.

  • TargetTrackingScaling

  • StepScaling

  • SimpleScaling (default)

  • PredictiveScaling

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-policytype

Type:

One of the following policy types

predictive_scaling_configuration

A predictive scaling policy. Provides support for predefined and custom metrics.

Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count.

Required if the policy type is PredictiveScaling .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-predictivescalingconfiguration

scaling_adjustment

The amount by which to scale, based on the specified adjustment type.

A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value.

Required if the policy type is SimpleScaling . (Not used with any other policy type.)

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-scalingadjustment

step_adjustments

A set of adjustments that enable you to scale based on the size of the alarm breach.

Required if the policy type is StepScaling . (Not used with any other policy type.)

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-stepadjustments

target_tracking_configuration

A target tracking scaling policy. Provides support for predefined or custom metrics.

The following predefined metrics are available:

  • ASGAverageCPUUtilization

  • ASGAverageNetworkIn

  • ASGAverageNetworkOut

  • ALBRequestCountPerTarget

If you specify ALBRequestCountPerTarget for the metric, you must specify the ResourceLabel property with the PredefinedMetricSpecification .

Required if the policy type is TargetTrackingScaling .

Link:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-scalingpolicy.html#cfn-autoscaling-scalingpolicy-targettrackingconfiguration