aws / aws-cdk-rfcs

RFCs for the AWS CDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PythonFunction additional build options

CoreOxide opened this issue · comments

Description

Today, CDK deploy uses docker as it's backend to collect and install dependencies. I'm proposing a way to do that without using Docker. It will also allow building for different OS targets and Lambda runtimes.

There are 2 ways to build without docker:

  • Using native dependency resolution using PIP flags.
  • Using AWS CloudShell (most useful for building Lambda Layers).

As @evgenyka suggested in #579, I want to inherit from PythonFunction and intorucde building backend options to the new class.

Looking for your approval before going forward.

Roles

Role User
Proposed by @CoreOxide
Author(s) @alias, @alias, @alias
API Bar Raiser @alias
Stakeholders @alias, @alias, @alias

See RFC Process for details

Workflow

  • Tracking issue created (label: status/proposed)
  • API bar raiser assigned (ping us at #aws-cdk-rfcs if needed)
  • Kick off meeting
  • RFC pull request submitted (label: status/review)
  • Community reach out (via Slack and/or Twitter)
  • API signed-off (label status/api-approved applied to pull request)
  • Final comments period (label: status/final-comments-period)
  • Approved and merged (label: status/approved)
  • Execution plan submitted (label: status/planning)
  • Plan approved and merged (label: status/implementing)
  • Implementation complete (label: status/done)

Author is responsible to progress the RFC according to this checklist, and
apply the relevant labels to this issue so that the RFC table in README gets
updated.

nice one, would really help me to remove docker dependency in my open source project that use cdk and Lambda.
@evgenyka please approve this approach :)

The aws-cdk-lib.aws_lambda.Function construct allows to perform local bundling, see the "Building locally" section in Building, bundling, and deploying applications with the AWS CDK blog post.

@evgenyka is there a reason aws-cdk.aws-lambda-python-alpha.PythonFunction can't support local bundling?

@evgenyka pls advise 👍

@alexpulver Local bundling supported in Go and NodeJS (esbuild) at the moment,
@CoreOxide similar to: https://github.com/1davidmichael/cdk-local-bundling-example?
You can get your PR against aws/aws-cdk#18290

@evgenyka it is similar, however my solution is more robust. my code will allow building for Lambda natively from MacOS and Windows, installing the correct packages for Linux instead of the OS you're running on (which is what will happen here -> https://github.com/1davidmichael/cdk-local-bundling-example).

I will open a PR under aws/aws-cdk#18290.