Skip to content

Instantly share code, notes, and snippets.

@umihico
Last active Dec 20, 2019
Embed
What would you like to do?
publish python layer in AWS Lambda easily
version: '3'
services:
app:
image: lambci/lambda:build-python3.7
volumes:
- '.:/var/task'
working_dir: /var/task
command: bash -c 'mkdir python && pip install -r requirements.txt -t ./python lxml && zip -r layer.zip python && rm -rf python'
wget https://gist.githubusercontent.com/umihico/8b1082980f29c9d72c69ff0a937f6ce8/raw/docker-compose.yml
echo $1>requirements.txt
docker-compose up
aws lambda publish-layer-version --layer-name $1 --zip-file fileb://layer.zip --compatible-runtimes python3.7
rm -rf layer.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment