I'm using the sam cli to build and deploy AWS Lambdas:
The sam build command iterates through the functions in your application, looks for a manifest file (such as requirements.txt) that contains the dependencies, and automatically creates deployment artifacts that you can deploy to Lambda using the sam package and sam deploy commands.
What's cool is that i can use the option flag --use-container
to build functions that have natively compiled dependencies inside an AWS Lambda-like Docker container.
What about AWS Lambda layers?
I have a function:
CreateImagesLambdaFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.7
Handler: lambda_function.create
CodeUri: ./functions/image_handler/
...
Layers:
- !Ref LayerPillow
that uses a layer with natively compiled dependencies (thus must be installed on linux):
LayerPillow:
Type: AWS::Serverless::LayerVersion
Properties:
...
ContentUri: ./functions/layer_pillow/
I can get around this by just install the dependencies using the amazonlinux:latest
docker image and copying to my repository, but was curious if SAM supported this functionality