Last active
May 14, 2019 14:28
-
-
Save JoaoCarabetta/e3e277f93445d109f704e3d4eaefeda5 to your computer and use it in GitHub Desktop.
Create Any Python Package Lambda Layer
This file contains hidden or 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
rm -r python | |
rm lambda_layer | |
mkdir python | |
printf "[install]\nprefix=" > ~/.pydistutils.cfg | |
pip3.7 install $1 -t python/ # insert any pip available module, repeat if necessary | |
printf "" > ~/.pydistutils.cfg | |
zip -r lambda_layer.zip ./python | |
aws s3 cp lambda_layer.zip s3://config-lambda/layers/$1/ | |
aws lambda publish-layer-version \ | |
--layer-name $1 \ | |
--content S3Bucket=config-lambda,S3Key=layers/$1/lambda_layer.zip \ | |
--compatible-runtimes python3.7 | |
rm -r python | |
rm lambda_layer.zip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment