Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(autoscaling): Add evaluationPeriods parameter for StepScalingPolicy #13315

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/@aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,16 @@ export interface StepScalingPolicyProps extends BasicStepScalingPolicyProps {
* The auto scaling group
*/
readonly autoScalingGroup: IAutoScalingGroup;

/**
* The number of the most recent periods, or data points, to evaluate when determining alarm state.
* @default Default evaluation periods for cloudwatch alarms
*/
readonly evaluationPeriods?: number;
}

/**
* Define a acaling strategy which scales depending on absolute values of some metric.
* Define a scaling strategy which scales depending on absolute values of some metric.
*
* You can specify the scaling behavior for various values of the metric.
*
Expand Down Expand Up @@ -111,7 +117,7 @@ export class StepScalingPolicy extends CoreConstruct {
metric: props.metric,
alarmDescription: 'Lower threshold scaling alarm',
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_OR_EQUAL_TO_THRESHOLD,
evaluationPeriods: 1,
evaluationPeriods: props.evaluationPeriods ?? 1,
threshold,
});
this.lowerAlarm.addAlarmAction(new StepScalingAlarmAction(this.lowerAction));
Expand Down Expand Up @@ -141,7 +147,7 @@ export class StepScalingPolicy extends CoreConstruct {
metric: props.metric,
alarmDescription: 'Upper threshold scaling alarm',
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
evaluationPeriods: 1,
evaluationPeriods: props.evaluationPeriods ?? 1,
threshold,
});
this.upperAlarm.addAlarmAction(new StepScalingAlarmAction(this.upperAction));
Expand Down