Python Lambda Layer Generator

Creates a Lambda layer zip file, given a list of Python libraries. Checks for vulnerabilities.

Created Feb 22, 2025 Updated Feb 22, 2025 by Nathaniel Ng

/dev Create a html javascript app that automatically generates the required code to build a Python Lambda layer zip file. The app should allow the user to specify the Python version and the libraries to be installed.

For example, if the Python version is 3.12 and the library specification is requests==2.32.3, the code generated from the app should be:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
mkdir test/
pyenv local 3.12
pyenv which python

cat << EOF > requirements.txt
requests==2.32.3
EOF

python -m venv create_layer
source create_layer/bin/activate
pip install -r requirements.txt
mkdir python
cp -r create_layer/lib python/
zip -r requests-py312.zip python

# Cleanup
deactivate
rm -rf create_layer/ python/

The app should include a text box displaying the generated code with syntax highlighting. There should be a copy to clipboard button as well as a download button. Use shadcn and dark mode. Use a library or API, such as Snyk, to check for library vulnerabilities.

Related Content

Find Prompts, Rules & Agents

Search through our comprehensive library for Amazon Q Developer