- Newest
- Most votes
- Most comments
To create and upload a Lambda Layer for Selenium with Python 3.12 on an arm64 architecture, you'll need to follow these steps:
-
Set up a Python 3.12 virtual environment on an ARM-based machine or use an ARM-based EC2 instance to ensure compatibility.
-
Install Selenium and the necessary webdriver binaries in this environment. You can use pip to install Selenium:
pip install selenium
-
Download the appropriate ARM64 webdriver binaries for the browsers you intend to use (e.g., ChromeDriver for Chrome).
-
Create a directory structure for your layer. The structure should look like this:
python/lib/python3.12/site-packages/ bin/
-
Copy the contents of your virtual environment's site-packages directory (including Selenium) into the python/lib/python3.12/site-packages/ directory.
-
Place the webdriver binaries in the bin/ directory.
-
Zip the entire contents of this directory structure. The resulting zip file will be your Lambda Layer.
-
Upload the layer to AWS Lambda:
- Open the AWS Lambda console
- Navigate to "Layers" in the left sidebar
- Click "Create layer"
- Provide a name for your layer (e.g., "selenium-python312-arm64")
- Upload the zip file you created
- Select Python 3.12 as the compatible runtime
- Choose "arm64" as the compatible architecture
- Click "Create" to finalize the layer creation
-
Once created, you can attach this layer to your Lambda function by selecting it in the function's configuration under the "Layers" section.
Remember to set the appropriate environment variables in your Lambda function to locate the webdriver binaries, typically by adding the /opt/bin directory to the PATH.
This process ensures that your Selenium layer is compatible with Python 3.12 and the arm64 architecture of your Lambda function.
Sources
Working with layers for Python Lambda functions - AWS Lambda
Community | Step-by-Step Guide to Creating an AWS Lambda Function Layer
Working with layers for Node.js Lambda functions - AWS Lambda
answered 2 years ago
Relevant content
asked 3 years ago
asked 3 years ago
- AWS OFFICIALUpdated 4 years ago
- AWS OFFICIALUpdated 8 months ago

Thanks for the response, but I tested and it's still not detecting the chromedriver.