top of page
Programming

How to add a Python library as an AWS layer

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.

  1. 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

1 comentario


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

Me gusta
download (7)_edited.png
Subscribe to my Youtube Channel @codewithgd

Related Articles

Videos you might like

Let's Get
Social

  • alt.text.label.Twitter
  • alt.text.label.LinkedIn
  • 25231
Subscribe to our NewsLetter

Join our mailing list to get a notification whenever a new blog is published. Don't worry we will not spam you.

bottom of page