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

Reduce CfnParameters for lambda.Function #3266

Closed
1 task done
artyom-melnikov opened this issue Jul 10, 2019 · 2 comments
Closed
1 task done

Reduce CfnParameters for lambda.Function #3266

artyom-melnikov opened this issue Jul 10, 2019 · 2 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda guidance Question that needs advice or information. package/cfn Related to the CFN layer (L1) response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@artyom-melnikov
Copy link

artyom-melnikov commented Jul 10, 2019

  • I'm submitting a ...

    • 🚀 feature request
  • What is the current behavior?

Currently for each lambda 2 CfnParameters are created (LambdaSourceBucketNameParameter and LambdaSourceObjectKeyParameter)

As you can see here: https://github.com/awslabs/aws-cdk/blob/4a0272db5eb9aae5f440bb0813fdbad6514b60c3/packages/%40aws-cdk/aws-lambda/lib/code.ts#L209

CloudFormation has a limitation of 60 parameters, meaning we can only have 30 lambda functions in a single stack

  • What is the expected behavior (or behavior of feature suggested)?

Add an ability to suppress creation of these parameters, or at least check for the duplicated values (for example LambdaSourceBucketNameParameter is duplicated in my case, since all lambda code assets are uploaded to the same CDKToolkit S3 bucket)

  • What is the motivation / use case for changing the behavior or adding this feature?

Do not add the additional limitations

  • Please tell us about your environment:

    • CDK CLI Version: 0.31.0 (build 7a70c08)
    • Module Version: xx.xx.xx
    • OS: all
    • Language: TypeScript
@artyom-melnikov artyom-melnikov added the needs-triage This issue or PR still needs to be triaged. label Jul 10, 2019
@skinny85
Copy link
Contributor

Hey @artyom-melnikov ,

thanks for opening the issue. You can reduce the number of created parameters by either:

a) re-using the same CfnParametersCode for multiple Lambda functions (they can have a different entrypoints, set with the handler property)
b) using explicit parameters provided when creating the CfnParametersCode, like this:

lambda.Code.cfnParameters({
  bucketNameParam: yourParam1,
  objectKeyParam: yourParam2,
});

(both bucketNameParam and objectKeyParam are optional construction properties of CfnParametersCode)

Hope this helps,
Adam

@NGL321 NGL321 added package/cfn Related to the CFN layer (L1) guidance Question that needs advice or information. @aws-cdk/aws-lambda Related to AWS Lambda response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 10, 2019
@artyom-melnikov
Copy link
Author

This indeed helped, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda guidance Question that needs advice or information. package/cfn Related to the CFN layer (L1) 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