Skip to content

Instantly share code, notes, and snippets.

@melvinkcx
Last active May 23, 2022 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save melvinkcx/5e1be9125b474210754cbd8ef2fc206f to your computer and use it in GitHub Desktop.
Save melvinkcx/5e1be9125b474210754cbd8ef2fc206f to your computer and use it in GitHub Desktop.
Bundle Python app managed with Poetry for AWS lambda
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