Skip to content

(@aws-cdk/aws-lambda-nodejs): NodejsFunction - Enable parallel building #28717

Open
@AllanOricil

Description

@AllanOricil

Describe the feature

Currently CDK builds one Function/NodeJsFunction at time but I believe it could try to build all lambda function on a given stack in parallel. This would reduce the amount of time the build phase takes, and make a better use of idle resources.

image

Use Case

I have an API which has one lambda per method. I did it this way because each method has different configs. This API has like 100 lambdas and it is a single stack. It takes a huge amount of time to build the entire stack because my lambdas are all built sequentially. It takes a lot of time to validate the api and run integration tests because of the build phase.

Proposed Solution

  • synth the stack
  • read its template to determine all lambdas that need to be built
  • spawn N docker containers (if forceDocker = true) or processes to build lambdas in parallel. Allow N (min) to be configurable as an env variable. N can be defined based on how many resources are available for docker in the machine used to build.
  • continue with the cdk flow

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.114.0

Environment details (OS name and version, etc.)

MacOS Sonoma Developer Beta 3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions