How to add a Python library as an AWS layer
- Gourav Dhar
- Aug 8, 2022
- 1 min read
A guide on adding a Python library as an AWS layer.

Not all libraries are present in the environment provided by AWS lambda (Obviously! It’s not possible). AWS provides a way to tackle this problem. If you want to use a common library (present in pip or a custom library) across various lambda functions, layers are the way to do it.
As of today, lambda does not provide requests . It is a commonly used library in python. I will take this as an example and create a layer for it in AWS.
Create a folder named python
pip install requests -t .
The above command will install the Python packages and their dependencies in the current folder, which is python .
The contents of the folder look like this to me:

2. Zip the folder

3. Open the layers tab in AWS and click on the button Create Layer .

4. Under name enter the desired name. Click on upload a zip file and upload the file you had zipped earlier. Select the appropriate runtimes and you are done.

Congrats!!! Your AWS layer is ready to be used with lambda functions.
This blog was originally published in the personal blog website of Gourav : https://gourav-dhar.com
Click here provide members with discounts on over-the-counter medications, vitamins, and health essentials, promoting better health management and cost-effective wellness solutions. kaiserotcbenefits.com - more details here
Click here help you find recent death notices, providing information about funeral services, memorials, and tributes for loved ones in your area. obituariesnearme.com - more details here
Click here? Many users have had mixed experiences with the platform, so it's important to read reviews and verify deals before booking. istravelurolegit.com - more details here