-
Notifications
You must be signed in to change notification settings - Fork 9
/
serverless.yml
170 lines (159 loc) · 5.43 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
service: ethiopia-covid-19-gateway
frameworkVersion: '>=1.1.0 <2.0.0'
plugins:
- serverless-domain-manager
- serverless-offline
provider:
name: aws
stage: ${opt:stage, 'dev'} # Set the default stage used. Default is dev
region: ${opt:region, 'us-east-2'} # Overwrite the default region used. Default is us-east-1
runtime: nodejs12.x
environment:
AUTH_ISS: ${cf:api-gateway-cognito.ProviderURL, LOCAL}
DOMAIN_NAME: ethiopia-covid19.com
DOCUMENT_DB_URL: ${env:LOCAL_DB_URL, 'mongodb://covidResponse:covidResponse@docdb-naods-cluster-01.cluster-cc9aixc24mlt.us-east-2.docdb.amazonaws.com:27017/covidResponse?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'}
VPC_SECURITY_GROUP_1: sg-3e5c8f59
VPC_SUBNET_GROUP_1: subnet-90840ddc
VPC_SUBNET_GROUP_2: subnet-1d93b567
VPC_SUBNET_GROUP_3: subnet-f569819e
functions:
public-create:
handler: handlers/public.create
cors: true
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/public/{type}
method: post
create:
handler: handlers/create.create
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/{type}
method: post
authorizer:
arn: arn:aws:cognito-idp:us-east-2:689384711846:userpool/us-east-2_4Sh8lFrAm
scopes:
- aws.cognito.signin.user.admin
- https://api.ethiopia-covid19.com/covid-gateway/resource/create
cors: true
request:
parameters:
paths:
type: true
list:
handler: handlers/list.list
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/{type}
method: get
authorizer:
arn: arn:aws:cognito-idp:us-east-2:689384711846:userpool/us-east-2_4Sh8lFrAm
scopes:
- aws.cognito.signin.user.admin
- https://api.ethiopia-covid19.com/covid-gateway/resource/list
cors: true
request:
parameters:
paths:
type: true
get:
handler: handlers/get.get
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/{type}/{id}
method: get
authorizer:
arn: arn:aws:cognito-idp:us-east-2:689384711846:userpool/us-east-2_4Sh8lFrAm
scopes:
- aws.cognito.signin.user.admin
- https://api.ethiopia-covid19.com/covid-gateway/resource/read
cors: true
request:
parameters:
paths:
type: true
id: true
update:
handler: handlers/update.update
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/{type}/{id}
method: put
authorizer:
arn: arn:aws:cognito-idp:us-east-2:689384711846:userpool/us-east-2_4Sh8lFrAm
scopes:
- aws.cognito.signin.user.admin
- https://api.ethiopia-covid19.com/covid-gateway/resource/update
cors: true
request:
parameters:
paths:
type: true
id: true
delete:
handler: handlers/delete.delete
vpc:
securityGroupIds:
- ${self:provider.environment.VPC_SECURITY_GROUP_1}
subnetIds:
- ${self:provider.environment.VPC_SUBNET_GROUP_1}
- ${self:provider.environment.VPC_SUBNET_GROUP_2}
- ${self:provider.environment.VPC_SUBNET_GROUP_3}
events:
- http:
path: gateway/{type}/{id}
method: delete
authorizer:
arn: arn:aws:cognito-idp:us-east-2:689384711846:userpool/us-east-2_4Sh8lFrAm
scopes:
- aws.cognito.signin.user.admin
- https://api.ethiopia-covid19.com/covid-gateway/resource/delete
cors: true
request:
parameters:
paths:
type: true
id: true
custom:
# Adds the Custom DNS Name for API Gateway
customDomain:
domainName: 'api.${self:provider.environment.DOMAIN_NAME}'
basePath: ''
stage: ${self:provider.stage}
certificateName: '*.${self:provider.environment.DOMAIN_NAME}'
createRoute53Record: false