- Python 3.8
- Python PIP
- Node
- NPM
- Httpie
- AWS credentials configured using
aws
cli
- Step 1: Install serverless module
npm install -g serverless
- Step 2: Install serverless plugins
sls plugin install -n serverless-python-requirements
- Step 3: Deploy function
sls deploy
- Step 4: Fetch the API Gateway url and run the function
http GET <your-gateway-url>
You should see a 401 Unauthorized
- Step 5: Generate a JWT token
pip install pyjwt
python3 -c 'import jwt; print(jwt.encode({"user":"John"},"secret",algorithm="HS256"))'
Copy the token
- Step 6: Send an authorized request
http GET <your-gateway-url> Authorization:<your-token>