Skip to content
v2.278.0

StepScalingPolicyProps ​

Struct Stable

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_cloudwatch as cloudwatch } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';

declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
declare const metric: cloudwatch.Metric;
const stepScalingPolicyProps: autoscaling.StepScalingPolicyProps = {
  autoScalingGroup: autoScalingGroupRef,
  metric: metric,
  scalingSteps: [{
    change: 123,

    // the properties below are optional
    lower: 123,
    upper: 123,
  }],

  // the properties below are optional
  adjustmentType: autoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
  cooldown: cdk.Duration.minutes(30),
  datapointsToAlarm: 123,
  estimatedInstanceWarmup: cdk.Duration.minutes(30),
  evaluationPeriods: 123,
  metricAggregationType: autoscaling.MetricAggregationType.AVERAGE,
  minAdjustmentMagnitude: 123,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_autoscaling as autoscaling
from aws_cdk import aws_cloudwatch as cloudwatch
from aws_cdk.interfaces import aws_autoscaling as interfaces_autoscaling

# auto_scaling_group_ref: interfaces_autoscaling.IAutoScalingGroupRef
# metric: cloudwatch.Metric

step_scaling_policy_props = autoscaling.StepScalingPolicyProps(
    auto_scaling_group=auto_scaling_group_ref,
    metric=metric,
    scaling_steps=[autoscaling.ScalingInterval(
        change=123,

        # the properties below are optional
        lower=123,
        upper=123
    )],

    # the properties below are optional
    adjustment_type=autoscaling.AdjustmentType.CHANGE_IN_CAPACITY,
    cooldown=cdk.Duration.minutes(30),
    datapoints_to_alarm=123,
    estimated_instance_warmup=cdk.Duration.minutes(30),
    evaluation_periods=123,
    metric_aggregation_type=autoscaling.MetricAggregationType.AVERAGE,
    min_adjustment_magnitude=123
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.autoscaling.*;
import software.amazon.awscdk.services.cloudwatch.*;
import software.amazon.awscdk.interfaces.autoscaling.*;

IAutoScalingGroupRef autoScalingGroupRef;
Metric metric;

StepScalingPolicyProps stepScalingPolicyProps = StepScalingPolicyProps.builder()
        .autoScalingGroup(autoScalingGroupRef)
        .metric(metric)
        .scalingSteps(List.of(ScalingInterval.builder()
                .change(123)

                // the properties below are optional
                .lower(123)
                .upper(123)
                .build()))

        // the properties below are optional
        .adjustmentType(AdjustmentType.CHANGE_IN_CAPACITY)
        .cooldown(Duration.minutes(30))
        .datapointsToAlarm(123)
        .estimatedInstanceWarmup(Duration.minutes(30))
        .evaluationPeriods(123)
        .metricAggregationType(MetricAggregationType.AVERAGE)
        .minAdjustmentMagnitude(123)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.AutoScaling;
using Amazon.CDK.AWS.CloudWatch;
using Amazon.CDK.Interfaces.AutoScaling;

IAutoScalingGroupRef autoScalingGroupRef;
Metric metric;

var stepScalingPolicyProps = new StepScalingPolicyProps {
    AutoScalingGroup = autoScalingGroupRef,
    Metric = metric,
    ScalingSteps = new [] { new ScalingInterval {
        Change = 123,

        // the properties below are optional
        Lower = 123,
        Upper = 123
    } },

    // the properties below are optional
    AdjustmentType = AdjustmentType.CHANGE_IN_CAPACITY,
    Cooldown = Duration.Minutes(30),
    DatapointsToAlarm = 123,
    EstimatedInstanceWarmup = Duration.Minutes(30),
    EvaluationPeriods = 123,
    MetricAggregationType = MetricAggregationType.AVERAGE,
    MinAdjustmentMagnitude = 123
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var autoScalingGroupRef IAutoScalingGroupRef
var metric Metric

stepScalingPolicyProps := &StepScalingPolicyProps{
	AutoScalingGroup: autoScalingGroupRef,
	Metric: metric,
	ScalingSteps: []ScalingInterval{
		&ScalingInterval{
			Change: jsii.Number(123),

			// the properties below are optional
			Lower: jsii.Number(123),
			Upper: jsii.Number(123),
		},
	},

	// the properties below are optional
	AdjustmentType: awscdk.Aws_autoscaling.AdjustmentType_CHANGE_IN_CAPACITY,
	Cooldown: cdk.Duration_Minutes(jsii.Number(30)),
	DatapointsToAlarm: jsii.Number(123),
	EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)),
	EvaluationPeriods: jsii.Number(123),
	MetricAggregationType: awscdk.*Aws_autoscaling.MetricAggregationType_AVERAGE,
	MinAdjustmentMagnitude: jsii.Number(123),
}

Properties ​

adjustmentTypeoptionalAdjustmentTypeadjustment_typeoptionalAdjustmentTypeadjustmentTypeoptionalAdjustmentTypeAdjustmentTypeoptionalAdjustmentTypeAdjustmentTypeoptionalAdjustmentType = ChangeInCapacity #
How the adjustment numbers inside 'intervals' are interpreted.
autoScalingGroupIAutoScalingGroupRefauto_scaling_groupIAutoScalingGroupRefautoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRef required #
The auto scaling group.
cooldownoptionalDurationcooldownoptionalDurationcooldownoptionalDurationCooldownoptionalDurationCooldownoptionalDuration #
Grace period after scaling activity.

Default: Default cooldown period on your AutoScalingGroup

datapointsToAlarmoptionalnumberdatapoints_to_alarmoptionalint | floatdatapointsToAlarmoptionalNumberDatapointsToAlarmoptionaldoubleDatapointsToAlarmoptional*float64 #
The number of data points out of the evaluation periods that must be breaching to trigger a scaling action.

Default: Same as evaluationPeriods

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.

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

Default: Same as the cooldown

evaluationPeriodsoptionalnumberevaluation_periodsoptionalint | floatevaluationPeriodsoptionalNumberEvaluationPeriodsoptionaldoubleEvaluationPeriodsoptional*float64 = 1 #
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.

metricIMetricmetricIMetricmetricIMetricMetricIMetricMetricIMetric required #
Metric to scale on.
metricAggregationTypeoptionalMetricAggregationTypemetric_aggregation_typeoptionalMetricAggregationTypemetricAggregationTypeoptionalMetricAggregationTypeMetricAggregationTypeoptionalMetricAggregationTypeMetricAggregationTypeoptionalMetricAggregationType #
Aggregation to apply to all data points over the evaluation periods.

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

Only has meaning if evaluationPeriods != 1.

minAdjustmentMagnitudeoptionalnumbermin_adjustment_magnitudeoptionalint | floatminAdjustmentMagnitudeoptionalNumberMinAdjustmentMagnitudeoptionaldoubleMinAdjustmentMagnitudeoptional*float64 #
Minimum absolute number to adjust capacity with as result of percentage scaling.

Default: No minimum scaling effect

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

scalingStepsScalingInterval[]scaling_stepstyping.List[ScalingInterval]scalingStepsList<ScalingInterval>ScalingStepsScalingInterval[]ScalingSteps*[]ScalingInterval required #
The intervals for scaling.

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

Must be between 2 and 40 steps.