Building and bundling Lambda dependencies
Pulumi program to demonstrate how to install dependencies and package up code for deployment to AWS Lambda functions
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set aws-ts-multi-language-lambdacd pulumi-examples/aws-ts-multi-language-lambdaThis example shows how to install dependencies and build multiple Lambda functions in different languages and then deploy the results.
You don’t need to install any languages other than Node.js because we’ll use Docker containers to build the code.
Prerequisites#
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init dev -
Set the AWS region to deploy into:
Terminal window pulumi config set aws:region us-west-2 -
Install dependencies:
Terminal window npm install -
Deploy the stack:
Terminal window pulumi upOnce all the resources have deployed, you can run the Lambdas and see the outputs.
Cleaning up#
Once you’re finished, destroy the resources and remove the stack:
pulumi destroypulumi stack rm