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

(autoscaling): step scaling policy max steps not validated correctly #27020

Open
scanlonp opened this issue Sep 5, 2023 · 0 comments
Open

(autoscaling): step scaling policy max steps not validated correctly #27020

scanlonp opened this issue Sep 5, 2023 · 0 comments
Assignees
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. p2

Comments

@scanlonp
Copy link
Contributor

scanlonp commented Sep 5, 2023

Describe the bug

#26215 asked for validation on the max number of steps in a step scaling policy. @jedkass noted that certain policies over 20 steps fail deployment (#26215 (comment)).

Expected Behavior

Invalid number of steps in a policy fails at synth time rather than deploy time.

Current Behavior

Calling a private method like below where scalableTaskCount was created on a FargateService object:

defineAutoScaleDownPolicy(scalableTaskCount: ScalableTaskCount) {
    const minTaskCount = this.someConfig.minTaskCount;
    const maxTaskCount = this.someConfig.maxTaskCount;
    const scalingSteps = [];
    for (let lowerThreshold = 10; maxTaskCount - lowerThreshold > minTaskCount; lowerThreshold += 10) {
      scalingSteps.push({
        lower: lowerThreshold,
        change: -lowerThreshold + 10,
      });
    }

    scalableTaskCount.scaleOnMetric(`some-unique-id`, {
      metric: myMetric,
      adjustmentType: AdjustmentType.CHANGE_IN_CAPACITY,
      scalingSteps: scalingSteps,
    });
  }
}

minTaskCount is 40 and maxTaskCount is 267, which results in scalingSteps.length == 22

This fails to deploy with

There can be at most 20 step adjustments per scaling policy (Service: AWSApplicationAutoScaling; Status Code: 400; Error Code: ValidationException, etc...

Reproduction Steps

See current behavior.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.94.0

Framework Version

No response

Node.js Version

18

OS

Mac

Language

Typescript

Language Version

No response

Other information

No response

@scanlonp scanlonp added bug This issue is a bug. p2 labels Sep 5, 2023
@scanlonp scanlonp self-assigned this Sep 5, 2023
@scanlonp scanlonp added the @aws-cdk/aws-sqs Related to Amazon Simple Queue Service label Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. p2
Projects
None yet
Development

No branches or pull requests

1 participant