aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.65k stars 3.91k forks source link

(autoscaling): StepScalingPolicy add evaluationPeriods parameter #13252

Closed BDeus closed 3 years ago

BDeus commented 3 years ago

When creating a StepScalingPolicy for an ASG, we cannot configured the evaluationPeriods of the CloudwatchAlarm created in underlying. The default value is enforced to 1

Proposed Solution

Add a property in BasicStepScalingPolicyProps:

/**
  * The number of the most recent periods, or data points, to evaluate when determining alarm state.
  * @default Default evaluation periods for cloudwatch alarms
  */
  readonly alarmEvaluationPeriods?: number;
}
...
this.upperAlarm = new cloudwatch.Alarm(this, 'UpperAlarm', {
    // Recommended by AutoScaling
    metric: props.metric,
    alarmDescription: 'Upper threshold scaling alarm',
    comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
    evaluationPeriods: props.alarmEvaluationPeriods,
    threshold,
});

Links

https://github.com/aws/aws-cdk/blob/404b5569bb76e3f579dd3005dcf06eeeae9df7f6/packages/%40aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts#L109

https://github.com/aws/aws-cdk/blob/404b5569bb76e3f579dd3005dcf06eeeae9df7f6/packages/%40aws-cdk/aws-autoscaling/lib/step-scaling-policy.ts#L144


This is a :rocket: Feature Request

rix0rrr commented 3 years ago

Closed by #13366

github-actions[bot] commented 3 years ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.