What kind of approaches do you use when creating AWS Lambda functions with Pulumi that require dependencies? Let's say I have for example a Lambda function created with NodeJS. Running npm install and adding node_module directory inside Pulumi project doesn't look like a good idea. Kind a same thing if I would like to use Lambda layers.
d
damp-school-17708
08/23/2021, 12:11 PM
I use webpack to pack it in one single file, at least it also shrinks the size, importing only what's necessary
layers are another option, or docker images
l
little-cartoon-10569
08/23/2021, 9:39 PM
I have no webpack experience and a few lambdas. How does this work with your repos and CI? Do you have your lambda code elsewhere and packed in a previous CI step? Is there a Pulumi example that you used to get started?
c
curved-pencil-86122
08/24/2021, 7:14 AM
Thanks for the tips Antonio. I have no webpack experience. Since in this project Lambdas are infra related - such as antivirus support - I'm going to check the Docker option; Include the Dockerfile to the Pulumi code, build (install dependencies...)/push image with Pulumi and then use it with Lambda. Let's see how it goes
👍 1
d
damp-school-17708
08/24/2021, 8:00 AM
webpack is not too hard, config file and then you need a 'build' step before doing pulumi up.
the pulumi config will point to the packed file/folder and that's it