#!/bin/sh -x
#
# Build & Publish Lambda layer
#
# NOTE: You must run this on EC2 instances (or AWS linux container)
# to get correct version of native libraries included in layer zip-file.
# https://stackoverflow.com/questions/55508626/lambda-not-loading-cryptography-shared-library
#

rm -rf layer
mkdir -p layer/python
cd layer
pip3 install PyJWT -t python
pip3 install requests -t python
pip3 install cryptography -t python --upgrade
zip -r pyjwt.zip python
# aws lambda publish-layer-version \
#    --layer-name pyjwt --description "PyJWT for Python 3.7" \
#    --zip-file fileb://layer/pyjwt.zip --compatible-runtimes python3.7
