As it is described in the Amazon official documentation link here It is as simple as just creating a zip of all the folder contents after installing the required packages in your folder where you have your python lambda code.

As Vineeth pointed above in his comment, The very first step in moving from an inline code editor to a zip file upload approach is to change your lambda function handler name under configuration settings to include the python script file name that holds the lambda handler.

lambda_handler => {your-python-script-file-name}.lambda_handler.

Other solutions like python-lambda and lambda-uploader help with simplifying the process of uploading and the most importantly LOCAL TESTING. These will save a lot of time in development.

Answer from Santhosh Gandhe on Stack Overflow
🌐
Amazon Web Services
docs.aws.amazon.com β€Ί aws lambda β€Ί developer guide β€Ί building lambda functions with python β€Ί working with layers for python lambda functions
Working with layers for Python Lambda functions - AWS Lambda
This means creating a .zip file archive that contains the dependencies you want to use in your functions. Create the layer in Lambda. Add the layer to your functions. ... To create a layer, bundle your packages into a .zip file archive that meets the following requirements: Build the layer using the same Python version that you plan to use for the Lambda function.
🌐
Amazon Web Services
docs.aws.amazon.com β€Ί aws lambda β€Ί developer guide β€Ί managing lambda dependencies with layers
Managing Lambda dependencies with layers - AWS Lambda
You can include up to five layers per function. Also, you can use layers only with Lambda functions deployed as a .zip file archive. For functions defined as a container image, package your preferred runtime and all code dependencies when you create the container image.
Discussions

amazon web services - How do I add python libraries to an AWS lambda function for Alexa? - Stack Overflow
You can use pip freeze to list all installed packages and find the exact requirement name.) mkdir mylayer cd mylayer mkdir python pip install -t python/ zip -r mylayer.zip python Β· Upload the layer to aws. Go to enter link description here Β· This part is tricky - note that 'layer' is a resources shared by all lambdas ... More on stackoverflow.com
🌐 stackoverflow.com
Why am I unable to install any dependencies to Lambda Via Layers?
For information on AWS Service migration, see How do I migrate my services to another region? ... I have a simple package I would like to use in my python lambda function: bcrypt. I have tried many ways of installing this dependency, mainly following YT tutorials, but the way that makes the most sense to me is by utilizing layers... More on repost.aws
🌐 repost.aws
2
0
March 26, 2025
AWS Lambda python dependencies packaging issues
This documentation might be helpful. https://docs.aws.amazon.com/lambda/latest/dg/python-image.html Also, if you haven’t tried posting in one of the AWS subreddits, you might post there as well. r/AWS More on reddit.com
🌐 r/awslambda
2
2
April 14, 2024
How to run lambda functions with large sized python dependencies?
A Lambda container image has a 10 GB size limit: https://aws.amazon.com/blogs/aws/new-for-aws-lambda-container-image-support/ Use AWS SAM and the SAM CLI with a cloud9 instance and you got everything set up ready to explore how to use it. More on reddit.com
🌐 r/aws
15
10
October 25, 2022
🌐
Amazon Web Services
docs.aws.amazon.com β€Ί aws lambda β€Ί developer guide β€Ί managing lambda dependencies with layers β€Ί packaging your layer content
Packaging your layer content - AWS Lambda
layer_content.zip β”” java β”” lib β”” jackson-core-2.17.0.jar β”” <other potential dependencies> β”” ... ... For language-specific instructions on packaging, creating, and adding a layer, refer to the following pages: Node.js – Working with layers for Node.js Lambda functions Β· Python – Working with layers for Python Lambda functions
🌐
Medium
medium.com β€Ί analytics-vidhya β€Ί aws-adding-python-libraries-to-lambda-layers-8c4eaf8fed80
AWS: Adding Python Libraries to Lambda Layers
May 12, 2021 - AWS Lambda Layers: Just package ... it to AWS. Also, once a layer is defined, all its underlying dependencies can be used by any number of Lambda functions. I feel the latter approach to be the best one as it saves a lot of time, space and promotes reproducibility. I will be discussing this approach only from now on. Please Note: Lambda uses amazon linux environment as its OS. Therefore, all the python packages that ...
Top answer
1 of 2
1
Hello. You can add a layer to the Lambda function by executing the following command in CloudShell. ``` mkdir python pip3 install bcrypt -t ./python zip -r ./python.zip . aws lambda publish-layer-version --layer-name python-layer --zip-file fileb://python.zip --compatible-runtimes python3.13 aws lambda update-function-configuration --function-name "Your Lambda Function Name" --layers arn:aws:lambda:::layer:python-layer:1 ``` CloudShell can be used by following the steps in the following document: https://docs.aws.amazon.com/cloudshell/latest/userguide/getting-started.html#launch-region-shell
2 of 2
0
It sounds like you're encountering some common issues with Lambda layers. Let's go through a few potential reasons why your Lambda function might not be finding the correct folder for your dependencies: 1. Incorrect folder structure: When creating a layer for Python dependencies, the correct structure is crucial. The packages should be in a folder named 'python' at the root of your zip file, and within that, they should be in the appropriate site-packages directory. For example: python/lib/python3.x/site-packages/. 2. Python version mismatch: Ensure that the Python version you're using to install the packages matches the runtime of your Lambda function. If you're using Python 3.13 in your layer structure, make sure your Lambda function is also set to use Python 3.13. 3. Layer size limits: Lambda has a maximum size limit for all layers combined when extracted. If your layer is too large, it might not be applied correctly. 4. Layer attachment: Make sure you've actually attached the layer to your Lambda function after creating it. 5. Permissions: Ensure your Lambda function has the necessary permissions to access the layer. To troubleshoot: 1. Double-check your folder structure in the zip file. 2. Verify that the Python version in your layer matches your Lambda runtime. 3. Check the size of your layer - if it's very large, consider optimizing it. 4. Confirm that the layer is attached to your function. 5. Review the function's execution role to ensure it has permissions to use the layer. If you're still having issues, you might consider alternative approaches: 1. Include the dependencies directly in your Lambda deployment package instead of using a layer. 2. For larger dependencies, consider using Lambda container images, which have a much higher size limit (up to 10GB). Remember, while layers can be useful for managing dependencies, they're not always necessary. For simpler use cases, including dependencies directly in your deployment package can be more straightforward. **Sources** Unable to import module 'lambda_function': No module named 'requests | AWS re:Post Lambda Package Exceeds 60MB: Solutions for Large Dependencies? | AWS re:Post Packaging your layer content - AWS Lambda Lambda function package not found error | AWS re:Post
🌐
Amazon Web Services
docs.aws.amazon.com β€Ί aws lambda β€Ί developer guide β€Ί building lambda functions with python β€Ί working with .zip file archives for python lambda functions
Working with .zip file archives for Python Lambda functions - AWS Lambda
Libraries in function layers therefore have precedence over versions included in the runtime. In the Python 3.11 managed runtime and base image, the AWS SDK and its dependencies are installed in the /var/lang/lib/python3.11/site-packages directory. You can see the full search path for your ...
Find elsewhere
🌐
Ian Wootten
ianwootten.co.uk β€Ί 2022 β€Ί 01 β€Ί 27 β€Ί how-to-create-aws-lambda-layers-for-python-dependencies
How to Create AWS Lambda Layers for Python Dependencies β€” Ian Wootten
You’ll then be able to see the Layer under β€œAdditional Resources” from the AWS Lambda console and make use of it from any of your Lambda functions. This works great for runtimes up to Python 3.8, but later ones are unavailable from the lambci dockerhub images. Amazon have their own python lambda images, though I’ve not had success using them to build layers using the approach above. For other projects, I’d normally tackle bundling dependencies using something like the serverless.com framework though I’ve grown a bit tired of Python playing a second class citizen to JS - debugging errors quickly becomes difficult.
🌐
Nordcloud
nordcloud.com β€Ί home β€Ί content hub β€Ί lambda layers for python runtime
Lambda layers for Python runtime - Nordcloud
January 30, 2025 - However, if you want to benefit from all the Lambda Layers advantages you should deploy it separately. service: tropoLayer package: individually: true provider: name: aws runtime: python3.6 layers: tropoLayer: path: build # Build directory contains all python dependencies compatibleRuntimes: # supported runtime - python3.6 functions: tropo_test: handler: handler.lambda_handler package: exclude: - node_modules/** - build/** layers: - {Ref: TropoLayerLambdaLayer } # Ref to the created layer.
🌐
DEV Community
dev.to β€Ί rishabdugar β€Ί creating-aws-lambda-layers-for-python-runtime-a-complete-guide-3gi0
The Best Way to Create AWS Lambda λ Layers for Python 🐍 (Fast & Easy) : A Complete Guide - DEV Community
January 17, 2025 - To ensure compatibility, use pip’s --platform parameter to target AWS Lambda’s Linux environment: pip install ` --platform manylinux2014_x86_64 ` --target=layer/python ` --implementation cp ` --python-version 3.12 ` --only-binary=:all: --upgrade ` pandas numpy requests Β· This installs the dependencies directly into the layer/python directory, ready for packaging.
🌐
Medium
medium.com β€Ί @amarachi.ogu β€Ί installing-dependencies-for-aws-lambda-functions-using-layers-3a43bbe1831d
Installing Dependencies for AWS Lambda Functions Using Layers | by Amarachi Ogu | Medium
June 2, 2023 - In this blog post, we will walk through a simple method to install any required packages on Lambda using Layers. To demonstrate this, we will use AWS Cloud9 and install two dependencies: beautifulsoup4 and pandas.
🌐
GeeksforGeeks
geeksforgeeks.org β€Ί installation guide β€Ί how-to-install-python-packages-for-aws-lambda-layers
How to Install Python Packages for AWS Lambda Layers? - GeeksforGeeks
July 23, 2025 - If there is a need to update your common code or any dependency you can do so in one place rather than making changes in individual lambda functions. Since lambda layers provide a feature to store different versions you can use the older version of a package or a new version as per the requirements. Note: A lambda function can have up to 5 layers. In this tutorial, we will see how to install python packages for AWS ...
🌐
GitHub
github.com β€Ί mthenw β€Ί awesome-layers
GitHub - mthenw/awesome-layers: Ξ» A curated list of awesome AWS Lambda Layers. Sponsored by https://cloudash.dev Β· GitHub
ARN: arn:aws:lambda:us-east-1:085108115628:layer:chrome:6 Link: RafalWilinski/serverless-puppeteer-layers ... Link: keithrozario/Klayers Python packages incl.
Starred by 2.3K users
Forked by 184 users
🌐
Harshad Ranganathan
rharshad.com β€Ί aws-lambda-layers-python
AWS Lambda Layers for Python – Harshad Ranganathan
February 29, 2020 - Let’s list the contents of dir /opt/python (earlier we had copied our library into python folder when we packaged it). You can see that our library source files and dependencies are available at runtime for our function code. A function can use up to 5 layers at a time. The total unzipped size of the function and all layers can’t exceed the unzipped deployment package size limit of 250 MB. ... aws lambda layers exampleaws lambda layers pythonaws lambda layers python exampleaws lambda layer python pipaws lambda layer python packageaws lambda layer for pythonaws lambda layers python dependenciesgetting started with aws lambda layers for pythonaws lambda python import layercreate lambda layer pythonaws lambda layers Share Tweet +1
🌐
hatedabamboo notes
notes.hatedabamboo.me β€Ί lambda-pip-modules
Installing Python dependencies in AWS Lambda: easy pip guide
As a result, we get the following directory structure in our Lambda layer: bashlambda_layer/ β”œβ”€β”€ bin β”‚ β”œβ”€β”€ activate β”‚ β”œβ”€β”€ activate.csh β”‚ β”œβ”€β”€ activate.fish β”‚ β”œβ”€β”€ Activate.ps1 β”‚ β”œβ”€β”€ normalizer β”‚ β”œβ”€β”€ pip β”‚ β”œβ”€β”€ pip3 β”‚ β”œβ”€β”€ pip3.13 β”‚ β”œβ”€β”€ python -> python3 β”‚ β”œβ”€β”€ python3 -> /usr/bin/python3 β”‚ └── python3.13 -> python3 β”œβ”€β”€ include β”‚ └── python3.13 β”œβ”€β”€ lib β”‚ └── python3.13 β”‚ └── site-packages β”‚ β”œβ”€β”€ certifi β”‚ β”œβ”€β”€ certifi-2025.1.31.dist-info β”‚ β”œβ”€β”€ charse
🌐
Medium
medium.com β€Ί @dgomez.developer β€Ί aws-lambda-layers-creating-a-python-layer-with-custom-code-and-its-dependencies-for-using-it-in-8ec6f7528f5b
AWS lambda layers: Creating a Python layer with custom code and its dependencies for using it in all your Lambda functions | by Debora Gomez Bertoli | Medium
September 13, 2024 - In my case, I am using a monorepo for all my python lambda services but if you have each service/lambda in different repos this approach will work as well, you just need to follow the structure of the common library AWS lambda layer folder ( `common-lib`).
🌐
AWS Cloud Community
docs.powertools.aws.dev β€Ί lambda β€Ί python β€Ί 2.16.2
Homepage - Powertools for AWS Lambda (Python)
June 6, 2023 - Tracer, Validation and Parser require additional dependencies. If you prefer to install all of them, use pip install "aws-lambda-powertools[all]". ... Using Powertools for AWS Lambda (Python) via Lambda Layer?
🌐
DEV Community
dev.to β€Ί mmascioni β€Ί using-external-python-packages-with-aws-lambda-layers-526o
Using external Python packages with AWS Lambda layers - DEV Community
December 6, 2020 - If successful, you should have dependencies installed to the python folder you created earlier! Mine looks like this: poke-lambda | lambda_function.py | requirements.txt └───venv └───python └───bin └───certifi └───certifi-2020.11.8.dist-info └───chardet └───chardet-3.0.4.dist-info └───idna └───... 5. At this point, all we have to do is zip our `python` folder: `zip -r layer python/`. This will create a `layer.zip` file in your project's root directory.
🌐
DEV Community
dev.to β€Ί aws-builders β€Ί installing-python-dependencies-in-aws-lambda-easy-pip-guide-31o6
Installing Python dependencies in AWS Lambda: easy pip guide - DEV Community
March 31, 2025 - aws lambda publish-layer-version --layer-name python-requests-layer \ --zip-file fileb://python-requests.zip \ --compatible-runtimes python3.13 \ --compatible-architectures "arm64" Now, this layer will be available for us to use in our functions: This method allows for more complex and extensive dependencies inside your Lambda functions.
🌐
DevOps.dev
blog.devops.dev β€Ί creating-aws-lambda-layers-with-ffmpeg-and-python-dependencies-e-g-4e8450483867
Creating AWS Lambda Layers with ffmpeg and Python Dependencies (e.g., requests) Using Multi-Arch Docker Builds | by Carlos Biagolini | DevOps.dev
June 13, 2025 - After unzipping the layer (lambda_dependencies_arm64.zip or lambda_dependencies_x86.zip), you should see the following: layer/ β”œβ”€β”€ bin/ β”‚ └── ffmpeg # Native binary, must be executable └── python/ β”œβ”€β”€ bin/ # May contain scripts installed by pip β”œβ”€β”€ requests/ # Example pip package β”œβ”€β”€ urllib3/ β”œβ”€β”€ charset_normalizer/ β”œβ”€β”€ idna/ └── *.dist-info/ # Metadata folders for pip-installed packages