-
Notifications
You must be signed in to change notification settings - Fork 1k
Expand file tree
/
Copy pathapigw-python-cdk-lambda-snapstart.json
More file actions
101 lines (101 loc) · 3.8 KB
/
apigw-python-cdk-lambda-snapstart.json
File metadata and controls
101 lines (101 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
{
"title": "Integrate AWS Lambda SnapStart function with Amazon API Gateway",
"description": "This pattern demonstrates how to create a REST API using Amazon API Gateway, AWS Lambda with SnapStart, and Amazon DynamoDB.",
"language": "Python",
"level": "200",
"framework": "AWS CDK",
"introBox": {
"headline": "How it works",
"text": [
"This pattern creates a REST API for managing car records using API Gateway and Lambda with SnapStart enabled.",
"The Lambda function is Python 3.12-based and includes a live alias that's integrated with API Gateway for seamless deployments.",
"Lambda SnapStart persists the initialized state of the Lambda runtime, significantly reducing cold start times for function initialization.",
"DynamoDB stores car records with a partition key of 'id', providing a scalable NoSQL database backend for the REST API."
]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-patterns/tree/main/apigw-python-cdk-lambda-snapstart",
"templateURL": "serverless-patterns/apigw-python-cdk-lambda-snapstart",
"projectFolder": "apigw-python-cdk-lambda-snapstart",
"templateFile": "app.py"
}
},
"resources": {
"bullets": [
{
"text": "AWS Lambda SnapStart",
"link": "https://docs.aws.amazon.com/lambda/latest/dg/snapstart.html"
},
{
"text": "API Gateway REST API",
"link": "https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-rest-api.html"
},
{
"text": "AWS CDK Python Reference",
"link": "https://docs.aws.amazon.com/cdk/v2/guide/work-with-cdk-python.html"
}
]
},
"deploy": {
"text": [
"python3 -m venv .venv",
"source .venv/bin/activate",
"pip install -r requirements.txt",
"cdk bootstrap",
"cdk deploy"
]
},
"testing": {
"text": [
"Get the CarEndpoint from stack outputs, then test the endpoint to create a new car record:",
"curl --location --request POST \"$ENDPOINT/cars\" --header 'Content-Type: application/json' --data-raw '{\"make\":\"Porsche\",\"model\":\"992\",\"year\":\"2022\",\"color\":\"White\"}'",
"Change the endpoint and HTTP method to test other operations:",
"GET /cars/{carId} - Retrieve a car",
"PUT /cars/{carId} - Update a car",
"DELETE /cars/{carId} - Delete a car"
]
},
"cleanup": {
"text": [
"Delete the stack: <code>cdk destroy</code>."
]
},
"authors": [
{
"name": "Matia Rasetina",
"image": "https://media.licdn.com/dms/image/v2/C4D03AQEpZLzvymfGyA/profile-displayphoto-shrink_800_800/profile-displayphoto-shrink_800_800/0/1612951581132?e=1772668800&v=beta&t=m8AkoSUFICMRk5-Gd0hEAji0N4gFSfFGuv4lbBuXcJY",
"bio": "Senior Software Engineer @ Elixirr Digital",
"linkedin": "matiarasetina",
"twitter": ""
}
],
"patternArch": {
"icon1": {
"x": 20,
"y": 50,
"service": "apigw",
"label": "API Gateway REST API"
},
"icon2": {
"x": 50,
"y": 50,
"service": "lambda",
"label": "AWS Lambda"
},
"icon3": {
"x": 80,
"y": 50,
"service": "dynamodb",
"label": "Amazon DynamoDB"
},
"line1": {
"from": "icon1",
"to": "icon2"
},
"line2": {
"from": "icon2",
"to": "icon3"
}
}
}