An example of using AWS Lambda Layers
docker build -t aws-lambda-layers:latest .; docker run --rm -p 9000:8080 aws-lambda-layers:latest
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
Follow the steps above first to build container image locally
Deploy the container image to AWS Elastic Container Registry
account_id=$(aws sts get-caller-identity --query "Account" --output text)
password=$(aws ecr get-login-password --region ap-southeast-2)
docker login -u AWS -p "$password" $account_id.dkr.ecr.ap-southeast-2.amazonaws.com
aws ecr create-repository --repository-name aws-lambda-layers --image-scanning-configuration scanOnPush=true --image-tag-mutability MUTABLE
docker tag aws-lambda-layers:latest $account_id.dkr.ecr.ap-southeast-2.amazonaws.com/aws-lambda-layers:latest
docker push $account_id.dkr.ecr.ap-southeast-2.amazonaws.com/aws-lambda-layers:latest
Then create a new Lambda Function from the container image loaded to ECR above via AWS console. Use x86_64
type lambda, if possible.