You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What makes an AWS Lambda handler resilient, traceable and easy to maintain? How do you write such a code?
21
+
## **The Problem**
23
22
24
-
The project is a template project that is based on my AWS Lambda handler cookbook blog series that I publish in [ranthebuilder.cloud](https://www.ranthebuilder.cloud) and attempt to answer those questions.
23
+
Starting a Serverless service can be overwhelming. You need to figure out many questions and challenges that have nothing to do with your business domain:
25
24
26
-
This project provides a working, open source based, AWS Lambda handler skeleton Python code including DEPLOYMENT code with CDK and a pipeline.
25
+
- How to deploy to the cloud? What IAC framework do you choose?
26
+
- How to write a SaaS-oriented CI/CD pipeline? What does it need to contain?
27
+
- How do you handle observability. Logging, tracing, metrics
28
+
- How do you handle testing?
29
+
- What makes an AWS Lambda handler resilient, traceable, and easy to maintain? How do you write such a code?
30
+
31
+
32
+
## **The Solution**
33
+
34
+
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service template
35
+
36
+
that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one template project.
37
+
38
+
### Serverless Service - The Order service
39
+
40
+
- This project provides a working orders service where customers can create orders of items.
41
+
42
+
- The project deploys an API GW with an AWS Lambda integration under the path POST /api/orders/ and stores data in a DynamoDB table.
27
43
28
-
The project deploys an API GW with an AWS Lambda integration under the path POST /api/service/.
44
+
### **Features**
29
45
30
-
The AWS Lambda handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler.
46
+
- Python Serverless service with a recommended file structure.
47
+
- CDK infrastructure with infrastructure tests and security tests.
48
+
- CI/CD pipelines based on Github actions that deploys to AWS.
49
+
- Unit/integration and E2E tests.
50
+
- The AWS Lambda handler embodies Serverless best practices and has all the bells and whistles for a proper production ready handler.
31
51
52
+
The GitHub template project can be found at [https://github.com/ran-isenberg/aws-lambda-handler-cookbook](https://github.com/ran-isenberg/aws-lambda-handler-cookbook).
32
53
33
54
34
55
## CDK Deployment
35
-
The CDK code create an API GW with a path of /api/service which triggers the lambda on 'POST' requests.
56
+
The CDK code create an API GW with a path of /api/orders which triggers the lambda on 'POST' requests.
36
57
37
58
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.
38
59
@@ -45,13 +66,14 @@ Each utility is implemented when a new blog post is published about that utility
45
66
46
67
The utilities cover multiple aspect of a production-ready service, including:
2.[Observability: Monitoring and Tracing](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-2-observability)
50
-
3.[Observability: Business Domain Metrics](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-3-business-domain-observability)
7.[Start Your AWS Serverless Service With Two Clicks](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-part-7-how-to-use-the-aws-lambda-cookbook-github-template-project)
-[Observability: Monitoring and Tracing](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-2-observability)
71
+
-[Observability: Business KPIs Metrics](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-3-business-domain-observability)
-[Start Your AWS Serverless Service With Two Clicks](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-part-7-how-to-use-the-aws-lambda-cookbook-github-template-project)
76
+
-[CDK Best practices](https://github.com/ran-isenberg/aws-lambda-handler-cookbook)
55
77
56
78
57
79
I've written 3 of the mentioned utilities (parser, feature flags and environment variables) and donated two of them, the [parser](https://awslabs.github.io/aws-lambda-powertools-python/latest/utilities/parser/) and [feature flags](https://awslabs.github.io/aws-lambda-powertools-python/latest/utilities/feature_flags/) to [AWS Lambda Powertools](https://awslabs.github.io/aws-lambda-powertools-python/latest/).
0 commit comments