<#18880 Allow building AWS Lambda Layers> Issue cr...
# github-notifications
c
#18880 Allow building AWS Lambda Layers Issue created by huonw Is your feature request related to a problem? Please describe. AWS Lambda has a concept of a layer, which is a (potentially) shared chunk of dependencies that are loaded into the environment, along with the main deploy package. This allows potential optimisations: • sharing common sets of dependencies across multiple lambdas • separating dependencies into a layer and source into the main deploy artefact: • faster builds: not having to wrangle potentially hundreds of megabytes of third party deps for a minor first-party source change that • more convenient iteration: the first party source artefact is likely to small enough (less than 3MB) to be viewed/edited in the AWS console for faster experimentation • putting large common dependencies (like boto3) into a single layer so that they're not needing to be duplicated into artefacts for individual lambdas (doing this useful would require pantsbuild/pex#2097 or similar, to ensure that the deps can be excluded from all other lambda packages) Describe the solution you'd like Create a new
python_awslambda_layer
target that uses
pex3 venv create --layout=flat-zipped --prefix=python ...
pantsbuild/pex#2140 (in 2.1.135) to export deps/src in the format expected: https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path Some questions/notes: • should this support parameters like
handler
at all? Or just require a user to specify
dependencies=["..."]
and `include_requirements`/`include_sources` as desired? I'm thinking just
dependencies
• It'd be good to allow
--layout=flat
to support #18282. Describe alternatives you've considered Reusing the
python_awslambda
target with a flag like
format="deployment" | "layer"
, which seems needlessly confusing. Additional context N/A pantsbuild/pants