BasicStepScalingPolicyProps

class aws_cdk.aws_autoscaling.BasicStepScalingPolicyProps(*, metric, scaling_steps, adjustment_type=None, cooldown=None, datapoints_to_alarm=None, estimated_instance_warmup=None, evaluation_periods=None, metric_aggregation_type=None, min_adjustment_magnitude=None)

Bases: object

Parameters:
  • metric (IMetric) – Metric to scale on.

  • scaling_steps (Sequence[Union[ScalingInterval, Dict[str, Any]]]) – The intervals for scaling. Maps a range of metric values to a particular scaling behavior. Must be between 2 and 40 steps.

  • adjustment_type (Optional[AdjustmentType]) – How the adjustment numbers inside ‘intervals’ are interpreted. Default: ChangeInCapacity

  • cooldown (Optional[Duration]) – Grace period after scaling activity. Default: Default cooldown period on your AutoScalingGroup

  • datapoints_to_alarm (Union[int, float, None]) – The number of data points out of the evaluation periods that must be breaching to trigger a scaling action. Creates an “M out of N” alarm, where this property is the M and the value set for evaluationPeriods is the N value. Only has meaning if evaluationPeriods != 1. Must be less than or equal to evaluationPeriods. Default: - Same as evaluationPeriods

  • estimated_instance_warmup (Optional[Duration]) – Estimated time until a newly launched instance can send metrics to CloudWatch. Default: Same as the cooldown

  • evaluation_periods (Union[int, float, None]) – How many evaluation periods of the metric to wait before triggering a scaling action. Raising this value can be used to smooth out the metric, at the expense of slower response times. If datapointsToAlarm is not set, then all data points in the evaluation period must meet the criteria to trigger a scaling action. Default: 1

  • metric_aggregation_type (Optional[MetricAggregationType]) – Aggregation to apply to all data points over the evaluation periods. Only has meaning if evaluationPeriods != 1. Default: - The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.

  • min_adjustment_magnitude (Union[int, float, None]) – Minimum absolute number to adjust capacity with as result of percentage scaling. Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size. Default: No minimum scaling effect

ExampleMetadata:

infused

Example:

# auto_scaling_group: autoscaling.AutoScalingGroup


worker_utilization_metric = cloudwatch.Metric(
    namespace="MyService",
    metric_name="WorkerUtilization"
)

auto_scaling_group.scale_on_metric("ScaleToCPU",
    metric=worker_utilization_metric,
    scaling_steps=[autoscaling.ScalingInterval(upper=10, change=-1), autoscaling.ScalingInterval(lower=50, change=+1), autoscaling.ScalingInterval(lower=70, change=+3)
    ],
    evaluation_periods=10,
    datapoints_to_alarm=5,

    # Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the
    # 'change' numbers before as percentages instead of capacity counts.
    adjustment_type=autoscaling.AdjustmentType.CHANGE_IN_CAPACITY
)

Attributes

adjustment_type

How the adjustment numbers inside ‘intervals’ are interpreted.

Default:

ChangeInCapacity

cooldown

Grace period after scaling activity.

Default:

Default cooldown period on your AutoScalingGroup

datapoints_to_alarm

The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.

Creates an “M out of N” alarm, where this property is the M and the value set for evaluationPeriods is the N value.

Only has meaning if evaluationPeriods != 1. Must be less than or equal to evaluationPeriods.

Default:
  • Same as evaluationPeriods

estimated_instance_warmup

Estimated time until a newly launched instance can send metrics to CloudWatch.

Default:

Same as the cooldown

evaluation_periods

How many evaluation periods of the metric to wait before triggering a scaling action.

Raising this value can be used to smooth out the metric, at the expense of slower response times.

If datapointsToAlarm is not set, then all data points in the evaluation period must meet the criteria to trigger a scaling action.

Default:

1

metric

Metric to scale on.

metric_aggregation_type

Aggregation to apply to all data points over the evaluation periods.

Only has meaning if evaluationPeriods != 1.

Default:
  • The statistic from the metric if applicable (MIN, MAX, AVERAGE), otherwise AVERAGE.

min_adjustment_magnitude

Minimum absolute number to adjust capacity with as result of percentage scaling.

Only when using AdjustmentType = PercentChangeInCapacity, this number controls the minimum absolute effect size.

Default:

No minimum scaling effect

scaling_steps

The intervals for scaling.

Maps a range of metric values to a particular scaling behavior.

Must be between 2 and 40 steps.