Skip to content

Instantly share code, notes, and snippets.

@jefrnc
Last active January 7, 2021 02:37
Show Gist options
  • Save jefrnc/ce6e074503a5a8bc374e44cdd6609783 to your computer and use it in GitHub Desktop.
Save jefrnc/ce6e074503a5a8bc374e44cdd6609783 to your computer and use it in GitHub Desktop.
Publicación de una slayer para una funcion Python (importando jwt)
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.7
sudo apt install pipenv
pip3 install pipenv --user
pipenv --python 3.7
pipenv shell
#pip install jwt
#pip uninstall jwt==1.0.0
#pip uninstall PyJWT
pip install PyJWT
#cat Pipfile
PY_DIR='build/python/lib/python3.7/site-packages'
mkdir -p $PY_DIR
#pipenv lock -r > requirements.txt
pip3 freeze > requirements.txt
cat requirements.txt
pip3 install -r requirements.txt --no-deps -t $PY_DIR
cd build
zip -r ../layer_jwt.zip .
rm -r build
aws lambda publish-layer-version \
--layer-name jwt \
--compatible-runtimes=python3.7 \
--zip-file fileb://layer_jwt.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment