-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
93 lines (87 loc) · 1.99 KB
/
serverless.yml
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
service: aws-lambda-crud
# One package per function
package:
individually: true
plugins:
- serverless-bundle # replace webpack, eslint...
- serverless-offline
- serverless-dotenv-plugin # use .env for environment variables
provider:
name: aws
runtime: nodejs10.x
stage: dev
region: eu-west-2
environment:
tableName: organisations
iamRoleStatements:
# operations allowed on dynamoDB
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
Resource: "arn:aws:dynamodb:eu-west-2:*:*"
resources:
# API gateway errors
- ${file(resources/api-gateway.yml)}
functions:
create:
handler: src/handlers/create.main
events:
- http:
path: org
method: post
cors: true
# authorizer: aws_iam
delete:
handler: src/handlers/delete.main
events:
- http:
path: org/{orgId}
method: delete
cors: true
# authorizer: aws_iam
list:
handler: src/handlers/list.main
events:
- http:
path: org
method: get
cors: true
# authorizer: aws_iam
listByParentId:
handler: src/handlers/listByParentId.main
events:
- http:
path: org/sub/{parentId}
method: get
cors: true
# authorizer: aws_iam
read:
handler: src/handlers/read.main
events:
- http:
path: org/{orgId}
method: get
cors: true
# authorizer: aws_iam
readByName:
handler: src/handlers/readByName.main
events:
- http:
path: org/name/{name}
method: get
cors: true
# authorizer: aws_iam
update:
handler: src/handlers/update.main
events:
- http:
path: org/{orgId}
method: put
cors: true
# authorizer: aws_iam