-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.yaml
More file actions
72 lines (68 loc) · 1.76 KB
/
template.yaml
File metadata and controls
72 lines (68 loc) · 1.76 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
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
TodoApp Python Back-end.
Globals:
Function:
Timeout: 5
Tags:
project: TodoApp
Environment:
Variables:
TABLE_NAME_TODOS: todos
Resources:
HelpersLayer:
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: HelpersLayer
Description: "Helpers dependencies : Database connexion, Data validation or whatever that will be used by many lambdas."
ContentUri: layers/helpers
CompatibleRuntimes:
- python3.8
ApiGatewayApi:
Type: AWS::Serverless::Api
Properties:
Name: TodosApi
StageName: v1
Cors:
AllowMethods: "'*'"
AllowHeaders: "'X-Api-Key,Authorization,X-Amz-Date,Content-Length,Host,Accept,Content-Type'"
AllowOrigin: "'*'"
TodosFunction:
Type: AWS::Serverless::Function
Properties:
FunctionName: TodosHandler
CodeUri: lambdas/todos
Handler: todos_function.lambda_handler
Runtime: python3.8
Policies:
- DynamoDBCrudPolicy:
TableName: todos
Events:
CreateTodos:
Type: Api
Properties:
Path: /todos
Method: post
RestApiId: !Ref ApiGatewayApi
GetTodoList:
Type: Api
Properties:
Path: /todos
Method: get
RestApiId: !Ref ApiGatewayApi
DeleteTodo:
Type: Api
Properties:
Path: /todos/{todoId}
Method: delete
RestApiId: !Ref ApiGatewayApi
Layers:
- !Ref HelpersLayer
TodosTable:
Type: AWS::Serverless::SimpleTable
Properties:
TableName: todos
PrimaryKey:
Name: id
Type: String