How to run lambda with external dependencies locally while excluding the dependencies from being packaged and pushed to AWS? #4855
Labels
guidance
General information and guidance, answers to FAQs, or recommended best practices/resources.
Your Environment
Question
Hi,
In order to run a lambda function that has external dependencies locally,
requirements.txt
has to be provided to specify the dependencies.The issue here is that
sam build
will package the dependencies with the lambda code that is pushed to AWS. However the dependencies already exist aslayers
in the AWS environment.Is there a way to avoid this? Or any other workaround?
I know doing a
sam deploy
without asam build
will exclude the dependencies from the package. However one problem with that approach is that the run executor runssam build
before running the function so, before deployment,.aws-sam
dir has to be deleted.Is there a way to specify a different build dir for the run executor build?
Thanks.
The text was updated successfully, but these errors were encountered: