Last active
May 23, 2022 08:39
-
-
Save melvinkcx/5e1be9125b474210754cbd8ef2fc206f to your computer and use it in GitHub Desktop.
Bundle Python app managed with Poetry for AWS lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OLDPWD=$(pwd) \ | |
&& cd "$(poetry env info --path)/lib/python3.9/site-packages" \ | |
&& zip -r9 ./app.zip . -x "*.pyc" \ | |
&& mv ./app.zip $OLDPWD \ | |
&& cd $OLDPWD \ | |
&& zip -rg ./app.zip ./app \ | |
&& aws lambda update-function-code --function-name my_function --zip-file fileb://app.zip | |
# A better alternative is to first upload to an S3 bucket, then update the function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment