Last active
February 16, 2018 18:55
-
-
Save sscarduzio/47c4a856d4760cdd9e49 to your computer and use it in GitHub Desktop.
When your python script has dependencies, you need to make a ZIP to upload in AWS Lambda.
This file contains hidden or 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
| #!/bin/bash | |
| ### NB: This script assumes you have set up your project in virtualenv! | |
| # Configure here your python script with dependencies | |
| ACTUAL_PYTHON_SCRIPT=rss.py | |
| WORKDIR_SUFFIX="__LAMBDA_PACK_SCRIPT" | |
| rm -rf $TMPDIR/*$WORKDIR_SUFFIX | |
| WORKDIR=`mktemp -d --suffix $WORKDIR_SUFFIX` | |
| cp $ACTUAL_PYTHON_SCRIPT $WORKDIR | |
| cp -r lib/python2.7/site-packages/* $WORKDIR | |
| pushd $WORKDIR | |
| zip lambda_upload.zip * | |
| popd | |
| mv $WORKDIR/lambda_upload.zip . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment