-
Notifications
You must be signed in to change notification settings - Fork 0
/
stack.yaml
333 lines (332 loc) · 11 KB
/
stack.yaml
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
Resources:
CoaidDonationHistoryBucket8D2E544D:
Type: AWS::S3::Bucket
Properties:
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
BucketName: coaid.donation.history-bucket
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidDonationHistoryBucket/Resource
DonationsTable5264C194:
Type: AWS::DynamoDB::Table
Properties:
KeySchema:
- AttributeName: donation_id
KeyType: HASH
AttributeDefinitions:
- AttributeName: donation_id
AttributeType: S
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
TableName: donations
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: CoaidInfraStack/DonationsTable/Resource
insertDonationLambdaServiceRoleB0FD0B6D:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: CoaidInfraStack/insertDonationLambda/ServiceRole/Resource
insertDonationLambdaServiceRoleDefaultPolicy6B9EBED6:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action: s3:*
Effect: Allow
Resource:
Fn::GetAtt:
- CoaidDonationHistoryBucket8D2E544D
- Arn
- Action: dynamodb:*
Effect: Allow
Resource:
- Fn::GetAtt:
- DonationsTable5264C194
- Arn
- Ref: AWS::NoValue
Version: "2012-10-17"
PolicyName: insertDonationLambdaServiceRoleDefaultPolicy6B9EBED6
Roles:
- Ref: insertDonationLambdaServiceRoleB0FD0B6D
Metadata:
aws:cdk:path: CoaidInfraStack/insertDonationLambda/ServiceRole/DefaultPolicy/Resource
insertDonationLambda4A002361:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Ref: AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7S3Bucket3582A5BD
S3Key:
Fn::Join:
- ""
- - Fn::Select:
- 0
- Fn::Split:
- "||"
- Ref: AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7S3VersionKey6685A8C5
- Fn::Select:
- 1
- Fn::Split:
- "||"
- Ref: AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7S3VersionKey6685A8C5
Role:
Fn::GetAtt:
- insertDonationLambdaServiceRoleB0FD0B6D
- Arn
Environment:
Variables:
DONATION_TABLE_NAME:
Ref: DonationsTable5264C194
DONATION_HISTORY_BUCKET_NAME:
Ref: CoaidDonationHistoryBucket8D2E544D
AWS_NODEJS_CONNECTION_REUSE_ENABLED: "1"
Handler: index.insertDonationData
Runtime: nodejs14.x
DependsOn:
- insertDonationLambdaServiceRoleDefaultPolicy6B9EBED6
- insertDonationLambdaServiceRoleB0FD0B6D
Metadata:
aws:cdk:path: CoaidInfraStack/insertDonationLambda/Resource
aws:asset:path: asset.72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7
aws:asset:property: Code
CoaidApiGatewayBDD70117:
Type: AWS::ApiGatewayV2::Api
Properties:
CorsConfiguration:
AllowMethods:
- "*"
AllowOrigins:
- "*"
Name: coaid-api
ProtocolType: HTTP
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/Resource
CoaidApiGatewayDefaultStage5F1C33FF:
Type: AWS::ApiGatewayV2::Stage
Properties:
ApiId:
Ref: CoaidApiGatewayBDD70117
StageName: $default
AutoDeploy: true
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/DefaultStage/Resource
CoaidApiGatewayGETinsertdonationCoaidInfraStackCoaidApiGatewayGETinsertdonation184107D2PermissionB700BFBB:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- insertDonationLambda4A002361
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: CoaidApiGatewayBDD70117
- /*/*/insert-donation
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/GET--insert-donation/CoaidInfraStackCoaidApiGatewayGETinsertdonation184107D2-Permission
CoaidApiGatewayGETinsertdonationHttpIntegration9e9f109d4b90654b288fb7937f0d9991BB0ABEA7:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId:
Ref: CoaidApiGatewayBDD70117
IntegrationType: AWS_PROXY
IntegrationUri:
Fn::GetAtt:
- insertDonationLambda4A002361
- Arn
PayloadFormatVersion: "2.0"
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/GET--insert-donation/HttpIntegration-9e9f109d4b90654b288fb7937f0d9991/Resource
CoaidApiGatewayGETinsertdonationA934A8BF:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId:
Ref: CoaidApiGatewayBDD70117
RouteKey: GET /insert-donation
AuthorizationType: NONE
Target:
Fn::Join:
- ""
- - integrations/
- Ref: CoaidApiGatewayGETinsertdonationHttpIntegration9e9f109d4b90654b288fb7937f0d9991BB0ABEA7
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/GET--insert-donation/Resource
CoaidApiGatewayPOSTinsertdonationCoaidInfraStackCoaidApiGatewayPOSTinsertdonationFFEEF3AFPermission4C1B7E15:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- insertDonationLambda4A002361
- Arn
Principal: apigateway.amazonaws.com
SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":execute-api:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- ":"
- Ref: CoaidApiGatewayBDD70117
- /*/*/insert-donation
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/POST--insert-donation/CoaidInfraStackCoaidApiGatewayPOSTinsertdonationFFEEF3AF-Permission
CoaidApiGatewayPOSTinsertdonation2F026F7A:
Type: AWS::ApiGatewayV2::Route
Properties:
ApiId:
Ref: CoaidApiGatewayBDD70117
RouteKey: POST /insert-donation
AuthorizationType: NONE
Target:
Fn::Join:
- ""
- - integrations/
- Ref: CoaidApiGatewayGETinsertdonationHttpIntegration9e9f109d4b90654b288fb7937f0d9991BB0ABEA7
Metadata:
aws:cdk:path: CoaidInfraStack/CoaidApiGateway/POST--insert-donation/Resource
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAAE11RwU7DMAz9Fu6pt7JxZ0ya4AJT4Qe8NFRpm6SKnU1VlH+nSWEHTu/ZeX5+Vmqot3vYPjzjjSrZDpsonVcQPxnlII7OEvsgWRy/7UfgKbBoFLngpRIHIsWLrtO2y+9n9GgUK5+Lu2rhi0urWTubRN4SaQfxJchBFduVJdHOFo1rLxC/8DKWwUKSGNFcWqysa1VP8F7gFKzMlkKjgdi4daDg2Y1aziVRYUnQrsIclqBk/jWEuEjuPlmuvNFEa9BJd8jqhvP1EeIr83SYdBZlyGU+vOxcSW41LvDK3iyrzuOf8b+y6FJKIl8EPW2u9R7qp+UXetK68sGyNgqaFX8ASQ6xaqIBAAA=
Metadata:
aws:cdk:path: CoaidInfraStack/CDKMetadata/Default
Condition: CDKMetadataAvailable
Outputs:
BucketNameExport:
Value:
Ref: CoaidDonationHistoryBucket8D2E544D
Export:
Name: CoaidDonationHistoryBucketName
InsertDonationAPI:
Value:
Fn::Join:
- ""
- - https://
- Ref: CoaidApiGatewayBDD70117
- .execute-api.
- Ref: AWS::Region
- "."
- Ref: AWS::URLSuffix
- /
Export:
Name: InsertDonationAPIName
Parameters:
AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7S3Bucket3582A5BD:
Type: String
Description: S3 bucket for asset "72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7"
AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7S3VersionKey6685A8C5:
Type: String
Description: S3 key for asset version "72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7"
AssetParameters72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7ArtifactHashF895528A:
Type: String
Description: Artifact hash for asset "72d2504449e06992eca1b537c17ecd008a2c6f0af2d7c6741901083ad1f334d7"
Conditions:
CDKMetadataAvailable:
Fn::Or:
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- af-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-east-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-2
- Fn::Equals:
- Ref: AWS::Region
- ap-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-2
- Fn::Equals:
- Ref: AWS::Region
- ca-central-1
- Fn::Equals:
- Ref: AWS::Region
- cn-north-1
- Fn::Equals:
- Ref: AWS::Region
- cn-northwest-1
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- eu-central-1
- Fn::Equals:
- Ref: AWS::Region
- eu-north-1
- Fn::Equals:
- Ref: AWS::Region
- eu-south-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-2
- Fn::Equals:
- Ref: AWS::Region
- eu-west-3
- Fn::Equals:
- Ref: AWS::Region
- me-south-1
- Fn::Equals:
- Ref: AWS::Region
- sa-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-2
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- us-west-1
- Fn::Equals:
- Ref: AWS::Region
- us-west-2