question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(lambda): Not able to provision concurrency for the current version of a lambda

See original GitHub issue

Not able to provision concurrency for the current version of a lambda

Reproduction Steps

I have a simple stack below to configure provisioned concurrency for a lambda

export class LambdaAutoScalingStack extends cdk.Stack {
    constructor(scope: cdk.App, id: string) {
        super(scope, id);

        new lambda.Function(this, 'lambda1', {
            code: new lambda.InlineCode('exports.handler = async () => { console.log(\'hello world\'); };'),
            handler: 'index.handler',
            runtime: lambda.Runtime.NODEJS_10_X,
            currentVersionOptions: {
                provisionedConcurrentExecutions: 3
            }
        })

    }
}

What did you expect to happen?

The lambda should have concurrency provisioned as 3 image

What actually happened?

No concurrency was provisioned image

Environment

  • CDK CLI Version : 1.94.1
  • Framework Version: 1.94.1
  • Node.js Version: v14.15.4
  • OS : Windows
  • Language (Version): TypeScript (3.9.7)

This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
tmhung88commented, Apr 7, 2021

Hi @tmhung88 -

currentVersionOptions take effect only when the currentVersion getter is called.

You will need to modify your code as -

const fn = new lambda.Function(...);
fn.currentVersion;

The last line actually creates the currentVersion.

Thanks. I confirm the provision is done when fn.currentVersion is called.

// The getter call is quite unexpected. It’d be great if the constructor lambdas.Function invokes this getter, or hide this detail from developers.

3reactions
nija-atcommented, Apr 7, 2021

Hi @tmhung88 -

currentVersionOptions take effect only when the currentVersion getter is called.

You will need to modify your code as -

const fn = new lambda.Function(...);
fn.currentVersion;

The last line actually creates the currentVersion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configuring provisioned concurrency - AWS Lambda
To manage provisioned concurrency settings for a version or alias, use the Lambda console. You can configure provisioned concurrency on a version of...
Read more >
Lambda provisioned concurrency for $LATEST, or, updating ...
I have API gateway and Lambda working happily, without using any versions or aliases. I'd now like to enable provisioned concurrency. It seems...
Read more >
Provisioned Concurrency for AWS Lambda functions - IT Labs
It is important to know that Provisioned concurrency can be configured ONLY on Lambda Function ALIAS or VERSION. You can't configure it against...
Read more >
EnableProvisionedConcurrency - Trend Micro
Ensure that the Provisioned Concurrency performance feature is enabled for your Amazon Lambda functions in order to help your functions to scale without ......
Read more >
AWS Lambda Provisioned Concurrency: The End of Cold Starts
Go to the AWS Lambda console and select an existing Lambda function. Go to the Actions drop-down menu, and then select Publish new...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found