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
This repository was recommended in an AWS blog post [Best practices for accelerating development with serverless blueprints](https://aws.amazon.com/blogs/infrastructure-and-automation/best-practices-for-accelerating-development-with-serverless-blueprints/)
**That's it, your developer environment has been set! you are ready to deploy the service:**
44
54
45
-
```
55
+
```bash
46
56
cd {new repo folder}
47
57
poetry shell
48
58
make deploy
@@ -54,99 +64,101 @@ You can also run 'make pr' will run all checks, synth, file formatters , unit te
54
64
55
65
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:
56
66
57
-
- How to deploy to the cloud? What IAC framework do you choose?
58
-
- How to write a SaaS-oriented CI/CD pipeline? What does it need to contain?
59
-
- How do you handle observability, logging, tracing, metrics?
60
-
- How do you write a Lambda function?
61
-
- How do you handle testing?
62
-
- What makes an AWS Lambda handler resilient, traceable, and easy to maintain? How do you write such a code?
63
-
67
+
* How to deploy to the cloud? What IAC framework do you choose?
68
+
* How to write a SaaS-oriented CI/CD pipeline? What does it need to contain?
69
+
* How do you handle observability, logging, tracing, metrics?
70
+
* How do you write a Lambda function?
71
+
* How do you handle testing?
72
+
* What makes an AWS Lambda handler resilient, traceable, and easy to maintain? How do you write such a code?
64
73
65
74
## **The Solution**
66
75
67
-
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service template that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one template project.
68
-
69
-
## Concepts
70
-
71
-
I spoke at AWS re:invent 2023 with Heitor Lessa, Chief Architect of Powertools for AWS Lambda about the concepts I implemented in this project.
72
-
73
-
[](https://www.youtube.com/watch?v=52W3Qyg242Y)
76
+
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service blueprint that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one blueprint project.
74
77
75
78
### Serverless Service - The Order service
76
79
77
-
- This project provides a working orders service where customers can create orders of items.
80
+
* This project provides a working orders service where customers can create orders of items.
78
81
79
-
- The project deploys an API GW with an AWS Lambda integration under the path POST /api/orders/ and stores data in a DynamoDB table.
82
+
* The project deploys an API GW with an AWS Lambda integration under the path POST /api/orders/ and stores data in a DynamoDB table.
* AWS Lambda handler 3 layer architecture: handler layer, logic layer and data access layer
102
+
* Features flags and configuration based on AWS AppConfig
103
+
* Idempotent API
104
+
* REST API protected by WAF with four AWS managed rules in production deployment
105
+
* CloudWatch dashboards - High level and low level including CloudWatch alarms
106
+
* Unit, infrastructure, security, integration and end to end tests.
107
+
* Automatically generated OpenAPI endpoint: /swagger with Pydantic schemas for both requests and responses
108
+
* CI swagger protection - fails the PR if your swagger JSON file (stored at docs/swagger/openapi.json) is out of date
109
+
* Automated protection against API breaking changes
106
110
107
111
## CDK Deployment
112
+
108
113
The CDK code create an API GW with a path of /api/orders which triggers the lambda on 'POST' requests.
109
114
110
115
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.
111
116
112
117
This allows you to package any custom dependencies you might have, just add them to the Pipfile under the [packages] section.
113
118
114
119
## Serverless Best Practices
120
+
115
121
The AWS Lambda handler will implement multiple best practice utilities.
116
122
117
123
Each utility is implemented when a new blog post is published about that utility.
118
124
119
125
The utilities cover multiple aspect of a production-ready service, including:
-[Observability: Monitoring and Tracing](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-2-observability)
123
-
-[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)
128
-
-[CDK Best practices](https://github.com/ran-isenberg/aws-lambda-handler-cookbook)
*[Observability: Monitoring and Tracing](https://www.ranthebuilder.cloud/post/aws-lambda-cookbook-elevate-your-handler-s-code-part-2-observability)
129
+
*[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-blueprint-project)
134
+
*[CDK Best practices](https://github.com/ran-isenberg/aws-lambda-handler-cookbook)
*[Serverless OpenAPI Documentation with AWS Powertools](https://www.ranthebuilder.cloud/post/serverless-open-api-documentation-with-aws-powertools)
132
138
133
139
## Getting started
140
+
134
141
Head over to the complete project documentation pages at GitHub pages at [https://ran-isenberg.github.io/aws-lambda-handler-cookbook](https://ran-isenberg.github.io/aws-lambda-handler-cookbook/)
135
142
136
143
## Code Contributions
144
+
137
145
Code contributions are welcomed. Read this [guide.](https://github.com/ran-isenberg/aws-lambda-handler-cookbook/blob/main/CONTRIBUTING.md)
138
146
139
147
## Code of Conduct
148
+
140
149
Read our code of conduct [here.](https://github.com/ran-isenberg/aws-lambda-handler-cookbook/blob/main/CODE_OF_CONDUCT.md)
This repository was recommended in an AWS blog post [Best practices for accelerating development with serverless blueprints](https://aws.amazon.com/blogs/infrastructure-and-automation/best-practices-for-accelerating-development-with-serverless-blueprints/){:target="_blank" rel="noopener"}
12
+
13
+
<imgalt="aws article"src="./media/article.png" />
14
+
15
+
## Concepts
16
+
17
+
I spoke at AWS re:invent 2023 with Heitor Lessa, former Chief Architect of Powertools for AWS Lambda about the concepts I implemented in this project.
18
+
19
+
<iframewidth="560"height="315"src="https://www.youtube.com/embed/52W3Qyg242Y"title="YouTube video player"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"allowfullscreen></iframe>
20
+
9
21
## **The Problem**
10
22
11
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:
@@ -17,25 +29,19 @@ Starting a Serverless service can be overwhelming. You need to figure out many q
17
29
18
30
## **The Solution**
19
31
20
-
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service template that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one template project.
32
+
This project aims to reduce cognitive load and answer these questions for you by providing a skeleton Python Serverless service blueprint that implements best practices for AWS Lambda, Serverless CI/CD, and AWS CDK in one blueprint project.
21
33
22
34
### Serverless Service - The Order service
23
35
24
-
<imgalt="alt_text"src="./media/design.png" />
36
+
<imgalt="design"src="./media/design.png" />
25
37
26
38
- This project provides a working orders service where customers can create orders of items.
27
39
28
40
- The project deploys an API GW with an AWS Lambda integration under the path POST /api/orders/ and stores orders data in a DynamoDB table.
@@ -55,7 +61,7 @@ I spoke at AWS re:invent 2023 with Heitor Lessa, Chief Architect of Powertools f
55
61
- Automatically generated OpenAPI endpoint: /swagger with Pydantic schemas for both requests and responses
56
62
- Automated protection against API breaking changes
57
63
58
-
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){:target="_blank" rel="noopener"}.
64
+
The GitHub blueprint project can be found at [https://github.com/ran-isenberg/aws-lambda-handler-cookbook](https://github.com/ran-isenberg/aws-lambda-handler-cookbook){:target="_blank" rel="noopener"}.
0 commit comments