2 months, 1 week ago
Here are quick steps to create Lambda Layer of python packages. (click below "read more" to read full article):
Share on Facebook
- create empty folder and create two files in it.
- requirements.txt will have python packages for which you want to create layers.
- in zappa_settings.py, it needs to have folllowing content:
- Follow below steps in sequence:
- Create virtual env with python version which you are going to use in layers.
- python -m venv env
- source env/bin/activate
- pip install -r requirements.txt
- zappa package layer -o "python.zip"
- unzip python.zip -d ./python
- rm -r python.zip
- zip -r python.zip python
- if you are using AWS CLI and don't want to create and upload layer manually, use following command:
- aws lambda publish-layer-version --layer-name "some-layer" --zip-file fileb://python.zip
- Note down Layer ARN, That you can use it in lambda function.