This lab demonstrates how to include the package from PyPI.
After the creation of Python environment, install (Doc) the package "requests" into Python layer by executing:
pip install --target ./layer/python requestsThen importing requests package will be successful no matter import in handler function (/lambda/index.py) or in module in Python layer (/layer/python/common.py).
After deploying the Lambda function, invoke it from console with anything (the functions in this repo don't parse anything from the event so it's okay to pass anything, even blank data) and get the response.
Or invoke with AWS CLI:
aws lambda invoke \
--function-name <function-name> \
-output json \
/tmp/output.json && cat /tmp/output.json