some stuff to know about deploying a function to aws lambda:
main.py should look like this:
function handler_fn(event, context):
# do stuff
return { 'some': 'response'}all external packages need to live at same directory as main.py.
easy way to do this is make a virtualenv, install everything, then move the site-packages directory:
virtualenv test-env
source test-env/bin/activate
pip install requests gspread arrow
cp -r test-env/lib/python2.7/site-packages/* deploy-pkg/
cp main.py deploy-pkg/
cd deploy-pkg
zip -r ../lambda-pkg.zip *
once you have your .zip, upload it to s3 and hit the console.
- pandas is hard to package up
- might want to set a timeout longer than 3 seconds for long-running functions