This project provides a working, open source based, AWS Lambda handler skeleton Python code including DEPLOYMENT code with CDK and a pipeline.
This project can serve as a template for new Serverless services - CDK deployment code, pipeline and handler are covered.
📜Documentation | Blogs website
Contact details | ran.isenberg@ranthebuilder.cloud
What makes an AWS Lambda handler resilient, traceable and easy to maintain? How do you write such a code?
The project is a template project that is based on my AWS Lambda handler cookbook blog series that I publish in ranthebuilder.cloud and attempt to answer those questions.
This project provides a working, open source based, AWS Lambda handler skeleton Python code including DEPLOYMENT code with CDK and a pipeline.
The project deploys an API GW with an AWS Lambda integration under the path POST /api/service/.
The AWS Lambda handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler.
The CDK code create an API GW with a path of /api/service which triggers the lambda on 'POST' requests.
The AWS Lambda handler uses a Lambda layer optimization which takes all the packages under the [packages] section in the Pipfile and downloads them in via a Docker instance.
This allows you to package any custom dependencies you might have, just add them to the Pipfile under the [packages] section.
The AWS Lambda handler will implement multiple best practice utilities.
Each utility is implemented when a new blog post is published about that utility.
The utilities cover multiple aspect of a production-ready service, including:
- Logging
- Observability: Monitoring and Tracing
- Observability: Business Domain Metrics
- Environment variables
- Input validation
- Features flags & dynamic configuration
- Start Your AWS Serverless Service With Two Clicks
I've written 3 of the mentioned utilities (parser, feature flags and environment variables) and donated two of them, the parser and feature flags to AWS Lambda Powertools.
While the code examples are written in Python, the principles are valid to any supported AWS Lambda handler programming language.
This repository is the complementary code examples of my blog series "AWS Lambda Cookbook - Elevate your handler's code"
Head over to the complete project documentation pages at GitHub pages at https://ran-isenberg.github.io/aws-lambda-handler-cookbook
- Email: ran.isenberg@ranthebuilder.cloud
- Blog Website RanTheBuilder
- LinkedIn: ranisenberg
- Twitter: IsenbergRan
This library is licensed under the MIT License. See the LICENSE file.
