-
Notifications
You must be signed in to change notification settings - Fork 0
/
serverless.yml
308 lines (276 loc) · 8.45 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
service: SMSPMock
# Files we don't need to deploy to AWS
package:
individually: true
exclude:
- Requirements_Pack.tar.gz
- readme.md
- SMSP-StubTester-soapui-project.xml
- license.txt
- LICENSE
plugins:
- serverless-plugin-optimize
- serverless-domain-manager
custom:
accountID: ${env:AWS_ACCOUNT_ID}
regionName: ${self:provider.region}
stageName: ${self:provider.stage}
customDomain:
domainName: ${env:DOMAIN_NAME}
basePath: ''
stage: ${self:provider.stage}
createRoute53Record: true
provider:
name: aws
stage: prod
runtime: nodejs8.10
role: arn:aws:iam::${self:custom.accountID}:role/service-role/LambdaRole
region: eu-west-2 # London
versionFunctions: false # We don't want to retain older versions when we update a function.
stackTags:
STACK: "${self:service}"
REGION: "${self:custom.regionName}"
SERVICE: "${self:service}"
environment:
accountID: ${self:custom.accountID}
regionName: ${self:provider.region}
stageName: ${self:provider.stage}
functions:
Homepage:
handler: Homepage.entrypoint
description: Generates a default Homepage
memorySize: 128
timeout: 2
events:
- http:
method: get
path: /
integration: lambda-proxy
LoadData:
handler: LoadData.entrypoint
description: Loads data into DynamoDB to play (test) with
memorySize: 2048
timeout: 30
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /LoadData
integration: lambda-proxy
Patient:
handler: Patient.entrypoint
description: Shows a list of all loaded patients
memorySize: 128
timeout: 2
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /Patient
integration: lambda-proxy
Logs:
handler: Logs.entrypoint
description: Shows the message logs
memorySize: 128
timeout: 2
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /Logs
integration: lambda-proxy
Test:
handler: Test.entrypoint
description: Shows the Test form, allowing us to exercide the SOAP service
memorySize: 128
timeout: 2
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /Test
integration: lambda-proxy
logdata:
handler: logdata.entrypoint
description: Returns items from ${self:provider.stage}-pds-messages table, and details of one log entry
memorySize: 128
timeout: 5
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /logdata
integration: lambda-proxy
pdsdata:
handler: pdsdata.entrypoint
description: Returns items from ${self:provider.stage}-pds-data table, and details of one using the URL pattern /pdsdata/1234554321
memorySize: 128
timeout: 5
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /pdsdata
integration: lambda-proxy
Service:
handler: service.entrypoint
description: Code that implements a mock SMSP service
memorySize: 128
timeout: 4
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: post
path: service
integration: lambda-proxy
FHIRGET:
handler: fhirget.entrypoint
description: Code that implements a FHIR Instance Read service
memorySize: 128
timeout: 4
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /fhir/Patient/{patID}
integration: lambda-proxy
FHIRSEARCH:
handler: fhirsearch.entrypoint
description: Code that implements a mock SMSP service
memorySize: 128
timeout: 4
events:
- sns: arn:aws:sns:${self:custom.regionName}:${self:custom.accountID}:${self:provider.stage}-awaken
- http:
method: get
path: /fhir/Patient
integration: lambda-proxy
FHIRCAP:
handler: fhircap.entrypoint
description: Returns a capability statement.
memorySize: 128
timeout: 2
events:
- http:
method: get
path: /fhir/metadata
FHIRBASE:
handler: fhircap.entrypoint
description: Returns a capability statement.
memorySize: 128
timeout: 2
events:
- http:
method: options
path: /fhir
resources:
Resources:
PdsdataLogGroup: # Log group for the pdsdata function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
FHIRSEARCHLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
FHIRGETLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
LogdataLogGroup: # Log group for the logdata function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
ServiceLogGroup: # Log group for the service function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "3"
PatientLogGroup: # Log group for the Patient function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
LoadDataLogGroup: # Log group for the LoadData function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
HomepageLogGroup: # Log group for the Homepage function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
LogsLogGroup: # Log group for the Logs function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
TestLogGroup: # Log group for the pdsdata function
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
FHIRCAPLogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
FHIRCAP2LogGroup:
Type: AWS::Logs::LogGroup
Properties:
RetentionInDays: "1"
AwakenQ: # SNS Topic, where we send wakey wakey messages to other lambdas when homepage is run.
Type: AWS::SNS::Topic
Properties:
DisplayName: "Messages to wake other lambdas"
TopicName: ${self:provider.stage}-awaken
MessageTable: # DynamoDB table in which we'll log requests and responses...
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.stage}-pds-messages
AttributeDefinitions:
- AttributeName: id
AttributeType: S
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TimeToLiveSpecification:
AttributeName: expires
Enabled: true
PDSTable: # DynamoDB table in which we'll log requests and responses...
Type: AWS::DynamoDB::Table
Properties:
TableName: ${self:provider.stage}-pds-data
AttributeDefinitions:
- AttributeName: nhs_number
AttributeType: S
- AttributeName: family_name
AttributeType: S
- AttributeName: dob
AttributeType: S
- AttributeName: traceindex
AttributeType: S
KeySchema:
- AttributeName: nhs_number
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 10
WriteCapacityUnits: 10
GlobalSecondaryIndexes:
- IndexName: name
KeySchema:
- AttributeName: family_name
KeyType: HASH
- AttributeName: dob
KeyType: RANGE
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 10
- IndexName: traceindex
KeySchema:
- AttributeName: traceindex
KeyType: HASH
Projection:
ProjectionType: ALL
ProvisionedThroughput:
ReadCapacityUnits: 2
WriteCapacityUnits: 10