Skip to content
New issue

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

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

Already on GitHub? # to your account

(aws-lambda): Switching scaling option doesn't update the Provisioned Concurrency #30503

Closed
garysassano opened this issue Jun 10, 2024 · 3 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@garysassano
Copy link

Describe the bug

Starting point:

const scalableFunction = new NodejsFunction(this, "ScalableFunction", {
  functionName: "scalable-function",
  entry: join(__dirname, "..", "functions", "scalable", "index.ts"),
  runtime: Runtime.NODEJS_20_X,
  architecture: Architecture.ARM_64,
  memorySize: 1024,
  timeout: Duration.minutes(5),
  loggingFormat: LoggingFormat.JSON,
});

const scalableFunctionAlias = new Alias(this, "ScalableFunctionAlias", {
  aliasName: "live",
  version: scalableFunction.currentVersion,
});

scalableFunctionAlias
  .addAutoScaling({
    minCapacity: 1,
    maxCapacity: 10,
  })
  .scaleOnSchedule("ScaleUpInMorning", {
    schedule: Schedule.cron({ hour: "3", minute: "30" }),
    minCapacity: 5,
  });

I deploy the code, wait for the scheduled time and check that the Provisioned Concurrency correctly changed from 1 to 5 in Lambda AWS Console.

Then I update the code as follows:

scalableFunctionAlias
  .addAutoScaling({
    minCapacity: 1,
    maxCapacity: 10,
  })
  .scaleOnUtilization({
    utilizationTarget: 0.7,
  });

I deploy it and go check again in Lambda AWS Console:

image

The Provisioned Concurrency is still 5, it didn't get updated to the default minCapacity.

Expected Behavior

see above

Current Behavior

see above

Reproduction Steps

see above

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.145.0

Framework Version

No response

Node.js Version

20.13.1

OS

Ubuntu 22.04.3 LTS

Language

TypeScript

Language Version

No response

Other information

No response

@garysassano garysassano added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 10, 2024
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Jun 10, 2024
@pahud
Copy link
Contributor

pahud commented Jun 13, 2024

I think it makes sense here.

minCapacity is the minimal capacity to scale to. It doesn't mean it has to scale to that value on stack update.

Per CFN doc[1]:

The minimum value that you plan to scale in to. When a scaling policy is in effect, Application Auto Scaling can scale in (contract) as needed to the minimum capacity limit in response to changing demand.

@pahud pahud added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. p3 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Jun 13, 2024
Copy link

This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jun 15, 2024
@github-actions github-actions bot added closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. and removed closing-soon This issue will automatically close in 4 days unless further comments are made. labels Jun 20, 2024
@aws-cdk-automation
Copy link
Collaborator

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.

@aws aws locked as resolved and limited conversation to collaborators Jul 25, 2024
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort p3 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants