Hi, <#CRH5ENVDX|aws> <#CJ909TL6P|typescript> I am ...
# typescript
r
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
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
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
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
Thanks. : )