Amazon now provides images for Lambda runtimes on Docker Hub. See amazon/aws-sam-cli-emulation-image-python. It is important to use this specific set of images to avoid missing binaries, which can occur with similar Python 3.x containers from amazon/.
An easier way to build AWS Lambda deployment packages — with Docker instead of EC2
- Logging in to EC2 and creating a deployment package by hand is clumsy
- Instead, script package creation around the
amazonlinuximage (blessed as an official repository and linked from this AWS user guide)
build- introduced to build wheels per #2. In theory this should not affect how the environment functions, but in practice use image id823205fae3edif you want to be as close to the official lambda environment as possible. On 9/1/21 thebuildtag has been updated to support the Python3.8 runtime (only).
docker pull quiltdata/lambda
docker run --rm -v $(pwd)/create_table:/io -t \
-e GIT_REPO quiltdata/lambda \
bash /io/package.sh- Mount
/ioas a docker volume/ioshould containpackage.shand your lambda code \/iois where the deployment package, lambda.zip, is written \
- Pass environment variables with
-e --rmso that, for example, secure envs aren't written to disk
Modify package.sh to suit your own purposes.
docker build -t quiltdata/lambda .Use a personal access token:
git clone https://${TOKEN}@github.com/USER/REPO