Recommended packaging setup for SAM stacks #7925
Labels
stage/needs-feedback
Needs feedback from the community (are you also interested in/experiencing this?)
type/feature
Feature request
I'm currently working on an project that uses multiple AWS SAM stacks.
Some include one or more lambda's and various resources using Python 3.12.
We want the code to be easily testable and decoupled from eachother. Also, we want to keep our deployed lambda functions small, we don't want to deploy the whole project.
Per stack, I was thinking the underneath structure.
When then deploying the lamdbas, to ensure we don'at deploy the full project, we set the
CodeUri
to each of the lambdas:~/project_sam_stack_one/src/lambda_two/
This means, from within the runtime of the lambda, the
PYTHONPATH
will be set to theCodeUri
. This breaks.The option I can think of: doubling the directory structure to simulate the package being installedModify the
PYTHONPATH
and double your directory structure toFor this approach, the lambda packages are doubled. This is inspired by this article, doubling the directory structure.
For local development, this requires the
PYTHONPATH
to be modified, but feels weird with importing.Questions
The text was updated successfully, but these errors were encountered: