Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 1.18 KB

README.md

File metadata and controls

23 lines (14 loc) · 1.18 KB

pycares-lambda-layers

Solution for aws lambda ModuleNotFoundError: No module named * for example 'pycares._cares'

To rebuild the layer use the command below(docker required) ↓

docker run -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.8" /bin/sh -c "pip install -r requirements.txt -t python/lib/python3.8/site-packages/; exit"
zip -r sd-scan-lib-layer.zip python > /dev/null

Change python3.8 to your lambda enviroment python version you can find all aws lambda enviroment docker images here This example is for pycares only, but you can change requirements.txt and rebuild the later for any python library or separate all the dependencies into one layer.

Some useful links ↓

How do I create a Lambda layer

Deploy Python Lambda functions

Image repository URIs