pulumi-awsx icon indicating copy to clipboard operation
pulumi-awsx copied to clipboard

Simplify deploying Python and TypeScript lambdas with dependencies

Open t0yv0 opened this issue 1 year ago • 1 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Consider simplifying deploying lambda function code with dependencies as this is non-trivial for beginners.

An existing solution in this space is the lambda-builders library. It has CLI with a JSON-RPC interface. Scope of this library: “given a folder containing function's source code, the selected build action, and path to an artifacts folder, this library will produce built artifacts in the artifacts folder.”

Possibly Pulumi could integrate with it directly to provide a component library where you could write:

const testLambda = new aws.lambda.Function("test_lambda", {
    code: new lambda_builders.Nodejs("../path/to/package.json"), // uses lambda-builders 
    name: "lambda_function_name",
    role: iamForLambda.arn,
    handler: "index.test",
    runtime: "nodejs18.x",
 });

Affected area/feature

t0yv0 avatar May 24 '24 15:05 t0yv0

One interesting user story: https://levelup.gitconnected.com/my-journey-with-pulumi-and-the-serverless-framework-2b1398ee581a - there might be additional complications for CallbackFunction coming from closure serialization, but even if those were not fully addressed if we could guide users to a reasonable way to refactor CallbackFunctions into normal functions that could be helpful here.

t0yv0 avatar Jun 05 '24 15:06 t0yv0