Skip to content

Instantly share code, notes, and snippets.

@haranjackson
Created August 30, 2019 12:18
Show Gist options
  • Save haranjackson/aae6122fbe1d9d2b37c7409b705168bd to your computer and use it in GitHub Desktop.
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.
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