Created
August 30, 2019 12:18
-
-
Save haranjackson/aae6122fbe1d9d2b37c7409b705168bd to your computer and use it in GitHub Desktop.
Deploys Python PDFMiner library to an AWS Lambda layer (removing unnecessary test files to reduce size). You can specify the region, library version, and runtime.
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-1 | |
VER=20181108 | |
RUNTIME=python3.7 | |
docker run -v $(pwd):/out -it lambci/lambda:build-$RUNTIME \ | |
pip install pdfminer.six==$VER -t /out/build/pdfminer/python | |
pushd build/pdfminer | |
rm -rf python/Crypto/SelfTest/ | |
zip -r ../../pdfminer.zip python/ | |
popd | |
aws lambda publish-layer-version \ | |
--layer-name PdfMiner \ | |
--region $REGION \ | |
--description $VER \ | |
--zip-file fileb://pdfminer.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