Use Lambda layers to package code and dependencies that you want to reuse across multiple functions. Layers usually contain library dependencies, a custom runtime, or configuration files.
Below are the steps to create lambda layer and test it with lambda function.
- Check python version in your system with "py --version". This version and lambda runtime version MUST match. eg 3.13
- mkdir lambda_layer
- mkdir -p python
- pip install requests -t python/
- Zip python directory.
- Go to AWS and create Lambda layer by uploading python.zip file.
- Create lambda function with the same runtime version eg. 3.13 and attach lambda layer to it.
- import module required modules in lambda_function.py handle file
- Test the function by creating test event.

Top comments (0)