https://pulumi.com logo
r

rhythmic-fireman-45324

01/21/2021, 3:44 AM
Hi, #aws #typescript I am a serveless user and new to Pulumi. In serverless, plugins like sls-webpack and sls-bundle are encouraged to be used for optimizing and bundling lambda functions & dependencies. In Pulumi how should I handle it elegantly? Any best practice or plugins?
b

billowy-army-68599

01/21/2021, 4:13 AM
hey! It sort of depends, but a lot of users value out of using crosswalk and using things like the
FileAsset
classes, or you can even couple your function inline with your infrastructure code! https://www.pulumi.com/docs/guides/crosswalk/aws/lambda/
r

rhythmic-fireman-45324

01/21/2021, 4:42 AM
Hey thanks for reply. Yeah I saw the lambda magic function and love it! But how should I bundle the dependencies? Were you suggesting to use fileAsset to include it in lambda layer?
And I have a use case which is using apollo-server-lambda and graphql with lambda and apigateway. In sls I always bundle them through webpack plugin to best optimize the size, cause lambda layer is not necessary here. In pulumi, how could I do it? Can you give me bit more clues? 😊
b

billowy-army-68599

01/21/2021, 4:52 AM
so I'm no expert (hopefully maybe @white-balloon-205 can chime in here) but I believe the magic functions will compute this for you, take a look at this blog post https://www.pulumi.com/blog/lambdas-as-lambdas-the-magic-of-simple-serverless-functions/
r

rhythmic-fireman-45324

01/21/2021, 5:33 AM
Thanks. : )