Lambda

Working with Lambda Layers

When creating a zip for a Lambda Layer (Python 3.6+) you need a full path to site-packages as shown below, using python3.8 as an example. Despite the common guidance, python -m pip install packagename -t folder/path does not work.

python/lib/python3.8/site-packages

python
└── lib
    └── python3.8
        └── site-packages
            β”œβ”€β”€ aiohttp
            β”‚Β Β  β”œβ”€β”€ __init__.py
            β”‚   β”œβ”€β”€ ...
            β”œβ”€β”€ slack
            β”‚Β Β  β”œβ”€β”€ __init__.py
            β”‚Β Β  β”œβ”€β”€ ...
            β”œβ”€β”€ slackclient-2.5.0.dist-info
            β”‚Β Β  β”œβ”€β”€ ...

The folder will be unzipped at /opt

Last updated

Was this helpful?