Automate AWS Lambda Layer Creation for Python with terraform and GitHub Action
Complete Guide To Building & Publishing Python Lambda Layers with Terraform & GitHub Actions(CI/CD)
A little bit about serverless and AWS Lambda
I started my Devops career with the Google Cloud platform and used Cloud functions for event-driven serverless workloads. It was pretty straightforward — package the Python code with its dependencies, i.e. requirements.txt
and everything else will be taken care of by Cloud Function(i.e. GCP).
Then I got to work on AWS and stumbled upon the mighty AWS Lambda, the most used, powerful service in AWS. It was all great except for the part where you manage the code dependencies.
I kept looking for ways to use a requirements.txt
and got to know that we cannot do it here. Either we locally install all libraries, pack them with your code in a huge .zip, and upload them to Lambda(a nightmare to manage). Or use something called, Lambda Layers.
Before I Jump to layers and the best way to build and manage layers, let me talk about Lambda and serverless.