npm install -g serverless
serverless config credentials --provider aws --key <ACCESS KEY ID> --secret <SECRET KEY>
serverless plugin install -n serverless-python-requirements
serverless plugin install -n serverless-domain-manager
Add the following to the serverless.yml
file
plugins:
- serverless-python-requirements
- serverless-domain-manager
custom:
pythonRequirements:
dockerizePip: true
npm install
serverless create_domain # can take up to 40 minutes
serverless deploy
You can invoke your deployed functions using the following
# Activate a python envirionment locally
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# Test locally
serverless invoke local -f selfie --path test_data.json
serverless invoke local -f count
# Test Deployed version
serverless invoke -f selfie --path test_data.json