Created
January 27, 2022 13:49
-
-
Save iwootten/1b3d51acabb07770dca024dc33390905 to your computer and use it in GitHub Desktop.
Publishes Python Dependencies in a requirements.txt to a AWS Lambda Layer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REGION=eu-west-2 | |
RUNTIME=python3.8 | |
LAYER_NAME=scrapy | |
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \ | |
pip install -r /out/requirements.txt -t /out/build/$LAYER_NAME/python | |
cd build/$LAYER_NAME | |
zip -r ../../$LAYER_NAME.zip python/ | |
cd ../.. | |
aws lambda publish-layer-version \ | |
--layer-name $LAYER_NAME \ | |
--region $REGION \ | |
--zip-file fileb://$LAYER_NAME.zip \ | |
--compatible-runtimes $RUNTIME | |
rm -rf build *.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment