Serverless Python

experiment with the serverless framework using python

based on


# install `serverless framework` if not already installed
npm install serverless -g

# create serverless python project
serverless create --template aws-python3  --name numpy-test --path numpy-test

cd numpy-test

# create isolated virtualenv
virtualenv venv --python=python3
code .
# add code for ``

# activate virtualenv
source venv/bin/activate

# run to test

pip install numpy

# save dependencies
pip freeze > requirements.txt
cat requirements.txt

# install dependencies (don't need to execute if starting from scratch)
pip install -r requirements.txt

npm init --force

# add serverless `serverless-python-requirements` plugin
npm install --save serverless-python-requirements

# deploy
sls deploy

# invoke lambda and output log
sls invoke -f numpy --log

# cleanup
sls remove