AWS Lambda Function and Lambda Layers

Lambda with Lambda Layers

Create a Lambda Function that has a Lambda Layer added to it

This pattern deploys a Lambda Function and attaches a Lambda Layer to it.
The function imports mysql-connector-python package that is provisioned using Lambda Layer and prints a list of files in /opt directory. /opt is a location where Lambda Layers attach content.
Using layers reduces the size of uploaded deployment archives and makes it faster to deploy your code.

< Back to all patterns

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/terraform-lambda-layer

Deploy

terraform initterraform apply --auto-approve


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

terraform destroy

Created by:

Anton Babenko

Anton Babenko

AWS Hero, Terraform influencer, maintainer of Terraform AWS Modules, creator of serverless.tf, weekly.tf, modules.tf, and some more.

Follow on LinkedIn