cdk-lambda-subminute 2.0.108 → 2.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +354 -3
- package/_temp/TestStack.assets.json +45 -0
- package/_temp/TestStack.template.json +624 -0
- package/_temp/asset.08284ec1aa030f3fe4d66c1df4a8b19293166d91ebf7c370863c9f2a231a33e3/index.js +51 -0
- package/_temp/asset.5fa1330271b8967d9254ba2d4a07144f8acefe8b77e6d6bba38261373a50d5f8/index.d.ts +1 -0
- package/_temp/asset.5fa1330271b8967d9254ba2d4a07144f8acefe8b77e6d6bba38261373a50d5f8/index.js +1 -0
- package/_temp/cdk.out +1 -0
- package/_temp/manifest.json +154 -0
- package/_temp/tree.json +919 -0
- package/lib/cdk-lambda-subminute.js +3 -3
- package/package.json +17 -19
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Resources": {
|
|
3
|
+
"targetFunctionServiceRole6EE8FF2F": {
|
|
4
|
+
"Type": "AWS::IAM::Role",
|
|
5
|
+
"Properties": {
|
|
6
|
+
"AssumeRolePolicyDocument": {
|
|
7
|
+
"Statement": [
|
|
8
|
+
{
|
|
9
|
+
"Action": "sts:AssumeRole",
|
|
10
|
+
"Effect": "Allow",
|
|
11
|
+
"Principal": {
|
|
12
|
+
"Service": "lambda.amazonaws.com"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"Version": "2012-10-17"
|
|
17
|
+
},
|
|
18
|
+
"ManagedPolicyArns": [
|
|
19
|
+
{
|
|
20
|
+
"Fn::Join": [
|
|
21
|
+
"",
|
|
22
|
+
[
|
|
23
|
+
"arn:",
|
|
24
|
+
{
|
|
25
|
+
"Ref": "AWS::Partition"
|
|
26
|
+
},
|
|
27
|
+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
28
|
+
]
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"targetFunctionFDF105E2": {
|
|
35
|
+
"Type": "AWS::Lambda::Function",
|
|
36
|
+
"Properties": {
|
|
37
|
+
"Code": {
|
|
38
|
+
"ZipFile": "exports.handler = function(event, ctx, cb) { return cb(null, \"hi\"); })"
|
|
39
|
+
},
|
|
40
|
+
"Role": {
|
|
41
|
+
"Fn::GetAtt": [
|
|
42
|
+
"targetFunctionServiceRole6EE8FF2F",
|
|
43
|
+
"Arn"
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"FunctionName": "testTargetFunction",
|
|
47
|
+
"Handler": "index.handler",
|
|
48
|
+
"Runtime": "nodejs12.x"
|
|
49
|
+
},
|
|
50
|
+
"DependsOn": [
|
|
51
|
+
"targetFunctionServiceRole6EE8FF2F"
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
"LambdaSubminuteIteratorLambdaIteratorLambdaRole980819E8": {
|
|
55
|
+
"Type": "AWS::IAM::Role",
|
|
56
|
+
"Properties": {
|
|
57
|
+
"AssumeRolePolicyDocument": {
|
|
58
|
+
"Statement": [
|
|
59
|
+
{
|
|
60
|
+
"Action": "sts:AssumeRole",
|
|
61
|
+
"Effect": "Allow",
|
|
62
|
+
"Principal": {
|
|
63
|
+
"Service": "lambda.amazonaws.com"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"Version": "2012-10-17"
|
|
68
|
+
},
|
|
69
|
+
"Description": "An execution role for a Lambda function to invoke a target Lambda Function per time unit less than one minute",
|
|
70
|
+
"ManagedPolicyArns": [
|
|
71
|
+
{
|
|
72
|
+
"Fn::Join": [
|
|
73
|
+
"",
|
|
74
|
+
[
|
|
75
|
+
"arn:",
|
|
76
|
+
{
|
|
77
|
+
"Ref": "AWS::Partition"
|
|
78
|
+
},
|
|
79
|
+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
80
|
+
]
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"Fn::Join": [
|
|
85
|
+
"",
|
|
86
|
+
[
|
|
87
|
+
"arn:",
|
|
88
|
+
{
|
|
89
|
+
"Ref": "AWS::Partition"
|
|
90
|
+
},
|
|
91
|
+
":iam::aws:policy/AWSXRayDaemonWriteAccess"
|
|
92
|
+
]
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"Fn::Join": [
|
|
97
|
+
"",
|
|
98
|
+
[
|
|
99
|
+
"arn:",
|
|
100
|
+
{
|
|
101
|
+
"Ref": "AWS::Partition"
|
|
102
|
+
},
|
|
103
|
+
":iam::aws:policy/service-role/AWSLambdaVPCAccessExecutionRole"
|
|
104
|
+
]
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
],
|
|
108
|
+
"RoleName": "Lambda-Iterator-Role"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"LambdaSubminuteIteratorLambdaIteratorLambdaRoleDefaultPolicy259A62D8": {
|
|
112
|
+
"Type": "AWS::IAM::Policy",
|
|
113
|
+
"Properties": {
|
|
114
|
+
"PolicyDocument": {
|
|
115
|
+
"Statement": [
|
|
116
|
+
{
|
|
117
|
+
"Action": "lambda:InvokeFunction",
|
|
118
|
+
"Effect": "Allow",
|
|
119
|
+
"Resource": {
|
|
120
|
+
"Fn::GetAtt": [
|
|
121
|
+
"targetFunctionFDF105E2",
|
|
122
|
+
"Arn"
|
|
123
|
+
]
|
|
124
|
+
},
|
|
125
|
+
"Sid": "TargetLambdaPermission"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"Action": [
|
|
129
|
+
"xray:PutTraceSegments",
|
|
130
|
+
"xray:PutTelemetryRecords"
|
|
131
|
+
],
|
|
132
|
+
"Effect": "Allow",
|
|
133
|
+
"Resource": "*"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"Version": "2012-10-17"
|
|
137
|
+
},
|
|
138
|
+
"PolicyName": "LambdaSubminuteIteratorLambdaIteratorLambdaRoleDefaultPolicy259A62D8",
|
|
139
|
+
"Roles": [
|
|
140
|
+
{
|
|
141
|
+
"Ref": "LambdaSubminuteIteratorLambdaIteratorLambdaRole980819E8"
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"LambdaSubminuteIteratorLambdaIterator43007E8C": {
|
|
147
|
+
"Type": "AWS::Lambda::Function",
|
|
148
|
+
"Properties": {
|
|
149
|
+
"Code": {
|
|
150
|
+
"S3Bucket": {
|
|
151
|
+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
|
|
152
|
+
},
|
|
153
|
+
"S3Key": "08284ec1aa030f3fe4d66c1df4a8b19293166d91ebf7c370863c9f2a231a33e3.zip"
|
|
154
|
+
},
|
|
155
|
+
"Role": {
|
|
156
|
+
"Fn::GetAtt": [
|
|
157
|
+
"LambdaSubminuteIteratorLambdaIteratorLambdaRole980819E8",
|
|
158
|
+
"Arn"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"Description": "A function for breaking the limit of 1 minute with the CloudWatch Rules.",
|
|
162
|
+
"Environment": {
|
|
163
|
+
"Variables": {
|
|
164
|
+
"TARGET_FN_NAME": {
|
|
165
|
+
"Ref": "targetFunctionFDF105E2"
|
|
166
|
+
},
|
|
167
|
+
"AWS_NODEJS_CONNECTION_REUSE_ENABLED": "1"
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"FunctionName": "lambda-subminute-iterator",
|
|
171
|
+
"Handler": "index.lambdaHandler",
|
|
172
|
+
"MemorySize": 128,
|
|
173
|
+
"Runtime": "nodejs14.x",
|
|
174
|
+
"Timeout": 58,
|
|
175
|
+
"TracingConfig": {
|
|
176
|
+
"Mode": "Active"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"DependsOn": [
|
|
180
|
+
"LambdaSubminuteIteratorLambdaIteratorLambdaRoleDefaultPolicy259A62D8",
|
|
181
|
+
"LambdaSubminuteIteratorLambdaIteratorLambdaRole980819E8"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"LambdaSubminuteIteratorLambdaIteratorLogRetention5C3C3E8C": {
|
|
185
|
+
"Type": "Custom::LogRetention",
|
|
186
|
+
"Properties": {
|
|
187
|
+
"ServiceToken": {
|
|
188
|
+
"Fn::GetAtt": [
|
|
189
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A",
|
|
190
|
+
"Arn"
|
|
191
|
+
]
|
|
192
|
+
},
|
|
193
|
+
"LogGroupName": {
|
|
194
|
+
"Fn::Join": [
|
|
195
|
+
"",
|
|
196
|
+
[
|
|
197
|
+
"/aws/lambda/",
|
|
198
|
+
{
|
|
199
|
+
"Ref": "LambdaSubminuteIteratorLambdaIterator43007E8C"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"RetentionInDays": 90
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleB6DFA802": {
|
|
208
|
+
"Type": "AWS::IAM::Role",
|
|
209
|
+
"Properties": {
|
|
210
|
+
"AssumeRolePolicyDocument": {
|
|
211
|
+
"Statement": [
|
|
212
|
+
{
|
|
213
|
+
"Action": "sts:AssumeRole",
|
|
214
|
+
"Effect": "Allow",
|
|
215
|
+
"Principal": {
|
|
216
|
+
"Service": {
|
|
217
|
+
"Fn::FindInMap": [
|
|
218
|
+
"ServiceprincipalMap",
|
|
219
|
+
{
|
|
220
|
+
"Ref": "AWS::Region"
|
|
221
|
+
},
|
|
222
|
+
"states"
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
],
|
|
228
|
+
"Version": "2012-10-17"
|
|
229
|
+
},
|
|
230
|
+
"Description": "Execute a workflow related to executing a Lambda function per time unit less than 1 minute."
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
"LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleDefaultPolicy93E64C89": {
|
|
234
|
+
"Type": "AWS::IAM::Policy",
|
|
235
|
+
"Properties": {
|
|
236
|
+
"PolicyDocument": {
|
|
237
|
+
"Statement": [
|
|
238
|
+
{
|
|
239
|
+
"Action": "lambda:InvokeFunction",
|
|
240
|
+
"Effect": "Allow",
|
|
241
|
+
"Resource": [
|
|
242
|
+
{
|
|
243
|
+
"Fn::GetAtt": [
|
|
244
|
+
"targetFunctionFDF105E2",
|
|
245
|
+
"Arn"
|
|
246
|
+
]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"Fn::GetAtt": [
|
|
250
|
+
"LambdaSubminuteIteratorLambdaIterator43007E8C",
|
|
251
|
+
"Arn"
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
],
|
|
255
|
+
"Sid": "LambdaInvokePermissions"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"Action": "lambda:InvokeFunction",
|
|
259
|
+
"Effect": "Allow",
|
|
260
|
+
"Resource": [
|
|
261
|
+
{
|
|
262
|
+
"Fn::GetAtt": [
|
|
263
|
+
"LambdaSubminuteIteratorLambdaIterator43007E8C",
|
|
264
|
+
"Arn"
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"Fn::Join": [
|
|
269
|
+
"",
|
|
270
|
+
[
|
|
271
|
+
{
|
|
272
|
+
"Fn::GetAtt": [
|
|
273
|
+
"LambdaSubminuteIteratorLambdaIterator43007E8C",
|
|
274
|
+
"Arn"
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
":*"
|
|
278
|
+
]
|
|
279
|
+
]
|
|
280
|
+
}
|
|
281
|
+
]
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"Version": "2012-10-17"
|
|
285
|
+
},
|
|
286
|
+
"PolicyName": "LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleDefaultPolicy93E64C89",
|
|
287
|
+
"Roles": [
|
|
288
|
+
{
|
|
289
|
+
"Ref": "LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleB6DFA802"
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"LambdaSubminuteSubminuteStateMachine23D30D9D": {
|
|
295
|
+
"Type": "AWS::StepFunctions::StateMachine",
|
|
296
|
+
"Properties": {
|
|
297
|
+
"RoleArn": {
|
|
298
|
+
"Fn::GetAtt": [
|
|
299
|
+
"LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleB6DFA802",
|
|
300
|
+
"Arn"
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"DefinitionString": {
|
|
304
|
+
"Fn::Join": [
|
|
305
|
+
"",
|
|
306
|
+
[
|
|
307
|
+
"{\"StartAt\":\"ConfigureCount\",\"States\":{\"ConfigureCount\":{\"Type\":\"Pass\",\"Result\":{\"index\":0,\"count\":6},\"ResultPath\":\"$.iterator\",\"Next\":\"Iterator\"},\"Iterator\":{\"Next\":\"IsCountReached\",\"Retry\":[{\"ErrorEquals\":[\"Lambda.ServiceException\",\"Lambda.AWSLambdaException\",\"Lambda.SdkClientException\"],\"IntervalSeconds\":2,\"MaxAttempts\":6,\"BackoffRate\":2}],\"Type\":\"Task\",\"ResultPath\":\"$.iterator\",\"ResultSelector\":{\"index.$\":\"$.Payload.index\",\"count.$\":\"$.Payload.count\",\"continue.$\":\"$.Payload.continue\"},\"Resource\":\"arn:",
|
|
308
|
+
{
|
|
309
|
+
"Ref": "AWS::Partition"
|
|
310
|
+
},
|
|
311
|
+
":states:::lambda:invoke\",\"Parameters\":{\"FunctionName\":\"",
|
|
312
|
+
{
|
|
313
|
+
"Fn::GetAtt": [
|
|
314
|
+
"LambdaSubminuteIteratorLambdaIterator43007E8C",
|
|
315
|
+
"Arn"
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
"\",\"Payload.$\":\"$\"}},\"Wait for the target Lambda function finished\":{\"Type\":\"Wait\",\"Seconds\":10,\"Next\":\"Iterator\"},\"IsCountReached\":{\"Type\":\"Choice\",\"Choices\":[{\"Variable\":\"$.iterator.continue\",\"BooleanEquals\":true,\"Next\":\"Wait for the target Lambda function finished\"}],\"Default\":\"Done\"},\"Done\":{\"Type\":\"Pass\",\"End\":true}}}"
|
|
319
|
+
]
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
"StateMachineName": "lambda-subminute-statemachine"
|
|
323
|
+
},
|
|
324
|
+
"DependsOn": [
|
|
325
|
+
"LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleDefaultPolicy93E64C89",
|
|
326
|
+
"LambdaSubminuteSubminuteStateMachineStepFunctionExecutionRoleB6DFA802"
|
|
327
|
+
],
|
|
328
|
+
"UpdateReplacePolicy": "Delete",
|
|
329
|
+
"DeletionPolicy": "Delete"
|
|
330
|
+
},
|
|
331
|
+
"LambdaSubminuteSubminuteStateMachineEventsRoleE48C5374": {
|
|
332
|
+
"Type": "AWS::IAM::Role",
|
|
333
|
+
"Properties": {
|
|
334
|
+
"AssumeRolePolicyDocument": {
|
|
335
|
+
"Statement": [
|
|
336
|
+
{
|
|
337
|
+
"Action": "sts:AssumeRole",
|
|
338
|
+
"Effect": "Allow",
|
|
339
|
+
"Principal": {
|
|
340
|
+
"Service": "events.amazonaws.com"
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
],
|
|
344
|
+
"Version": "2012-10-17"
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"LambdaSubminuteSubminuteStateMachineEventsRoleDefaultPolicy88FF3DD8": {
|
|
349
|
+
"Type": "AWS::IAM::Policy",
|
|
350
|
+
"Properties": {
|
|
351
|
+
"PolicyDocument": {
|
|
352
|
+
"Statement": [
|
|
353
|
+
{
|
|
354
|
+
"Action": "states:StartExecution",
|
|
355
|
+
"Effect": "Allow",
|
|
356
|
+
"Resource": {
|
|
357
|
+
"Ref": "LambdaSubminuteSubminuteStateMachine23D30D9D"
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
],
|
|
361
|
+
"Version": "2012-10-17"
|
|
362
|
+
},
|
|
363
|
+
"PolicyName": "LambdaSubminuteSubminuteStateMachineEventsRoleDefaultPolicy88FF3DD8",
|
|
364
|
+
"Roles": [
|
|
365
|
+
{
|
|
366
|
+
"Ref": "LambdaSubminuteSubminuteStateMachineEventsRoleE48C5374"
|
|
367
|
+
}
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
"LambdaSubminuteStartSubminuteStateMachine54B0F2BF": {
|
|
372
|
+
"Type": "AWS::Events::Rule",
|
|
373
|
+
"Properties": {
|
|
374
|
+
"Description": {
|
|
375
|
+
"Fn::Join": [
|
|
376
|
+
"",
|
|
377
|
+
[
|
|
378
|
+
"A rule to run the subminute state machine, i.e. ",
|
|
379
|
+
{
|
|
380
|
+
"Fn::GetAtt": [
|
|
381
|
+
"LambdaSubminuteSubminuteStateMachine23D30D9D",
|
|
382
|
+
"Name"
|
|
383
|
+
]
|
|
384
|
+
}
|
|
385
|
+
]
|
|
386
|
+
]
|
|
387
|
+
},
|
|
388
|
+
"Name": "subminute-statemachine-lambda-rule",
|
|
389
|
+
"ScheduleExpression": "cron(50/1 15-17 ? * * *)",
|
|
390
|
+
"State": "ENABLED",
|
|
391
|
+
"Targets": [
|
|
392
|
+
{
|
|
393
|
+
"Arn": {
|
|
394
|
+
"Ref": "LambdaSubminuteSubminuteStateMachine23D30D9D"
|
|
395
|
+
},
|
|
396
|
+
"Id": "Target0",
|
|
397
|
+
"Input": "{\"iterator\":{\"index\":0,\"count\":6}}",
|
|
398
|
+
"RoleArn": {
|
|
399
|
+
"Fn::GetAtt": [
|
|
400
|
+
"LambdaSubminuteSubminuteStateMachineEventsRoleE48C5374",
|
|
401
|
+
"Arn"
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB": {
|
|
409
|
+
"Type": "AWS::IAM::Role",
|
|
410
|
+
"Properties": {
|
|
411
|
+
"AssumeRolePolicyDocument": {
|
|
412
|
+
"Statement": [
|
|
413
|
+
{
|
|
414
|
+
"Action": "sts:AssumeRole",
|
|
415
|
+
"Effect": "Allow",
|
|
416
|
+
"Principal": {
|
|
417
|
+
"Service": "lambda.amazonaws.com"
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
],
|
|
421
|
+
"Version": "2012-10-17"
|
|
422
|
+
},
|
|
423
|
+
"ManagedPolicyArns": [
|
|
424
|
+
{
|
|
425
|
+
"Fn::Join": [
|
|
426
|
+
"",
|
|
427
|
+
[
|
|
428
|
+
"arn:",
|
|
429
|
+
{
|
|
430
|
+
"Ref": "AWS::Partition"
|
|
431
|
+
},
|
|
432
|
+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
433
|
+
]
|
|
434
|
+
]
|
|
435
|
+
}
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB": {
|
|
440
|
+
"Type": "AWS::IAM::Policy",
|
|
441
|
+
"Properties": {
|
|
442
|
+
"PolicyDocument": {
|
|
443
|
+
"Statement": [
|
|
444
|
+
{
|
|
445
|
+
"Action": [
|
|
446
|
+
"logs:PutRetentionPolicy",
|
|
447
|
+
"logs:DeleteRetentionPolicy"
|
|
448
|
+
],
|
|
449
|
+
"Effect": "Allow",
|
|
450
|
+
"Resource": "*"
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
"Version": "2012-10-17"
|
|
454
|
+
},
|
|
455
|
+
"PolicyName": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB",
|
|
456
|
+
"Roles": [
|
|
457
|
+
{
|
|
458
|
+
"Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB"
|
|
459
|
+
}
|
|
460
|
+
]
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A": {
|
|
464
|
+
"Type": "AWS::Lambda::Function",
|
|
465
|
+
"Properties": {
|
|
466
|
+
"Handler": "index.handler",
|
|
467
|
+
"Runtime": "nodejs14.x",
|
|
468
|
+
"Code": {
|
|
469
|
+
"S3Bucket": {
|
|
470
|
+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
|
|
471
|
+
},
|
|
472
|
+
"S3Key": "5fa1330271b8967d9254ba2d4a07144f8acefe8b77e6d6bba38261373a50d5f8.zip"
|
|
473
|
+
},
|
|
474
|
+
"Role": {
|
|
475
|
+
"Fn::GetAtt": [
|
|
476
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB",
|
|
477
|
+
"Arn"
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
"DependsOn": [
|
|
482
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB",
|
|
483
|
+
"LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB"
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
"Mappings": {
|
|
488
|
+
"ServiceprincipalMap": {
|
|
489
|
+
"af-south-1": {
|
|
490
|
+
"states": "states.af-south-1.amazonaws.com"
|
|
491
|
+
},
|
|
492
|
+
"ap-east-1": {
|
|
493
|
+
"states": "states.ap-east-1.amazonaws.com"
|
|
494
|
+
},
|
|
495
|
+
"ap-northeast-1": {
|
|
496
|
+
"states": "states.ap-northeast-1.amazonaws.com"
|
|
497
|
+
},
|
|
498
|
+
"ap-northeast-2": {
|
|
499
|
+
"states": "states.ap-northeast-2.amazonaws.com"
|
|
500
|
+
},
|
|
501
|
+
"ap-northeast-3": {
|
|
502
|
+
"states": "states.ap-northeast-3.amazonaws.com"
|
|
503
|
+
},
|
|
504
|
+
"ap-south-1": {
|
|
505
|
+
"states": "states.ap-south-1.amazonaws.com"
|
|
506
|
+
},
|
|
507
|
+
"ap-south-2": {
|
|
508
|
+
"states": "states.ap-south-2.amazonaws.com"
|
|
509
|
+
},
|
|
510
|
+
"ap-southeast-1": {
|
|
511
|
+
"states": "states.ap-southeast-1.amazonaws.com"
|
|
512
|
+
},
|
|
513
|
+
"ap-southeast-2": {
|
|
514
|
+
"states": "states.ap-southeast-2.amazonaws.com"
|
|
515
|
+
},
|
|
516
|
+
"ap-southeast-3": {
|
|
517
|
+
"states": "states.ap-southeast-3.amazonaws.com"
|
|
518
|
+
},
|
|
519
|
+
"ca-central-1": {
|
|
520
|
+
"states": "states.ca-central-1.amazonaws.com"
|
|
521
|
+
},
|
|
522
|
+
"cn-north-1": {
|
|
523
|
+
"states": "states.cn-north-1.amazonaws.com"
|
|
524
|
+
},
|
|
525
|
+
"cn-northwest-1": {
|
|
526
|
+
"states": "states.cn-northwest-1.amazonaws.com"
|
|
527
|
+
},
|
|
528
|
+
"eu-central-1": {
|
|
529
|
+
"states": "states.eu-central-1.amazonaws.com"
|
|
530
|
+
},
|
|
531
|
+
"eu-central-2": {
|
|
532
|
+
"states": "states.eu-central-2.amazonaws.com"
|
|
533
|
+
},
|
|
534
|
+
"eu-north-1": {
|
|
535
|
+
"states": "states.eu-north-1.amazonaws.com"
|
|
536
|
+
},
|
|
537
|
+
"eu-south-1": {
|
|
538
|
+
"states": "states.eu-south-1.amazonaws.com"
|
|
539
|
+
},
|
|
540
|
+
"eu-south-2": {
|
|
541
|
+
"states": "states.eu-south-2.amazonaws.com"
|
|
542
|
+
},
|
|
543
|
+
"eu-west-1": {
|
|
544
|
+
"states": "states.eu-west-1.amazonaws.com"
|
|
545
|
+
},
|
|
546
|
+
"eu-west-2": {
|
|
547
|
+
"states": "states.eu-west-2.amazonaws.com"
|
|
548
|
+
},
|
|
549
|
+
"eu-west-3": {
|
|
550
|
+
"states": "states.eu-west-3.amazonaws.com"
|
|
551
|
+
},
|
|
552
|
+
"me-central-1": {
|
|
553
|
+
"states": "states.me-central-1.amazonaws.com"
|
|
554
|
+
},
|
|
555
|
+
"me-south-1": {
|
|
556
|
+
"states": "states.me-south-1.amazonaws.com"
|
|
557
|
+
},
|
|
558
|
+
"sa-east-1": {
|
|
559
|
+
"states": "states.sa-east-1.amazonaws.com"
|
|
560
|
+
},
|
|
561
|
+
"us-east-1": {
|
|
562
|
+
"states": "states.us-east-1.amazonaws.com"
|
|
563
|
+
},
|
|
564
|
+
"us-east-2": {
|
|
565
|
+
"states": "states.us-east-2.amazonaws.com"
|
|
566
|
+
},
|
|
567
|
+
"us-gov-east-1": {
|
|
568
|
+
"states": "states.us-gov-east-1.amazonaws.com"
|
|
569
|
+
},
|
|
570
|
+
"us-gov-west-1": {
|
|
571
|
+
"states": "states.us-gov-west-1.amazonaws.com"
|
|
572
|
+
},
|
|
573
|
+
"us-iso-east-1": {
|
|
574
|
+
"states": "states.amazonaws.com"
|
|
575
|
+
},
|
|
576
|
+
"us-iso-west-1": {
|
|
577
|
+
"states": "states.amazonaws.com"
|
|
578
|
+
},
|
|
579
|
+
"us-isob-east-1": {
|
|
580
|
+
"states": "states.amazonaws.com"
|
|
581
|
+
},
|
|
582
|
+
"us-west-1": {
|
|
583
|
+
"states": "states.us-west-1.amazonaws.com"
|
|
584
|
+
},
|
|
585
|
+
"us-west-2": {
|
|
586
|
+
"states": "states.us-west-2.amazonaws.com"
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
"Parameters": {
|
|
591
|
+
"BootstrapVersion": {
|
|
592
|
+
"Type": "AWS::SSM::Parameter::Value<String>",
|
|
593
|
+
"Default": "/cdk-bootstrap/hnb659fds/version",
|
|
594
|
+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
"Rules": {
|
|
598
|
+
"CheckBootstrapVersion": {
|
|
599
|
+
"Assertions": [
|
|
600
|
+
{
|
|
601
|
+
"Assert": {
|
|
602
|
+
"Fn::Not": [
|
|
603
|
+
{
|
|
604
|
+
"Fn::Contains": [
|
|
605
|
+
[
|
|
606
|
+
"1",
|
|
607
|
+
"2",
|
|
608
|
+
"3",
|
|
609
|
+
"4",
|
|
610
|
+
"5"
|
|
611
|
+
],
|
|
612
|
+
{
|
|
613
|
+
"Ref": "BootstrapVersion"
|
|
614
|
+
}
|
|
615
|
+
]
|
|
616
|
+
}
|
|
617
|
+
]
|
|
618
|
+
},
|
|
619
|
+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/resources/iterator/iterator_agent.ts
|
|
21
|
+
var iterator_agent_exports = {};
|
|
22
|
+
__export(iterator_agent_exports, {
|
|
23
|
+
lambdaHandler: () => lambdaHandler
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(iterator_agent_exports);
|
|
26
|
+
var AWS = require("aws-sdk");
|
|
27
|
+
var lambda = new AWS.Lambda();
|
|
28
|
+
var targetFunctionName = process.env.TARGET_FN_NAME;
|
|
29
|
+
var lambdaHandler = async (event) => {
|
|
30
|
+
const index = event.iterator.index + 1;
|
|
31
|
+
const params = {
|
|
32
|
+
FunctionName: targetFunctionName,
|
|
33
|
+
InvocationType: "Event"
|
|
34
|
+
};
|
|
35
|
+
lambda.invoke(params, function(error) {
|
|
36
|
+
if (error) {
|
|
37
|
+
console.log(error, error.stack);
|
|
38
|
+
} else {
|
|
39
|
+
console.log("The target function is triggered.");
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
return {
|
|
43
|
+
index,
|
|
44
|
+
continue: index < event.iterator.count,
|
|
45
|
+
count: event.iterator.count
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
lambdaHandler
|
|
51
|
+
});
|
package/_temp/asset.5fa1330271b8967d9254ba2d4a07144f8acefe8b77e6d6bba38261373a50d5f8/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function handler(event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handler=void 0;const AWS=require("aws-sdk");async function createLogGroupSafe(logGroupName,region,options){let retryCount=options?.maxRetries==null?10:options.maxRetries;const delay=options?.retryOptions?.base==null?10:options.retryOptions.base;do try{await new AWS.CloudWatchLogs({apiVersion:"2014-03-28",region,...options}).createLogGroup({logGroupName}).promise();return}catch(error){if(error.code==="ResourceAlreadyExistsException")return;if(error.code==="OperationAbortedException")if(retryCount>0){retryCount--,await new Promise(resolve=>setTimeout(resolve,delay));continue}else throw new Error("Out of attempts to create a logGroup");throw error}while(!0)}async function deleteLogGroup(logGroupName,region,options){let retryCount=options?.maxRetries==null?10:options.maxRetries;const delay=options?.retryOptions?.base==null?10:options.retryOptions.base;do try{await new AWS.CloudWatchLogs({apiVersion:"2014-03-28",region,...options}).deleteLogGroup({logGroupName}).promise();return}catch(error){if(error.code==="ResourceNotFoundException")return;if(error.code==="OperationAbortedException")if(retryCount>0){retryCount--,await new Promise(resolve=>setTimeout(resolve,delay));continue}else throw new Error("Out of attempts to delete a logGroup");throw error}while(!0)}async function setRetentionPolicy(logGroupName,region,options,retentionInDays){let retryCount=options?.maxRetries==null?10:options.maxRetries;const delay=options?.retryOptions?.base==null?10:options.retryOptions.base;do try{const cloudwatchlogs=new AWS.CloudWatchLogs({apiVersion:"2014-03-28",region,...options});retentionInDays?await cloudwatchlogs.putRetentionPolicy({logGroupName,retentionInDays}).promise():await cloudwatchlogs.deleteRetentionPolicy({logGroupName}).promise();return}catch(error){if(error.code==="OperationAbortedException")if(retryCount>0){retryCount--,await new Promise(resolve=>setTimeout(resolve,delay));continue}else throw new Error("Out of attempts to create a logGroup");throw error}while(!0)}async function handler(event,context){try{console.log(JSON.stringify({...event,ResponseURL:"..."}));const logGroupName=event.ResourceProperties.LogGroupName,logGroupRegion=event.ResourceProperties.LogGroupRegion,retryOptions=parseRetryOptions(event.ResourceProperties.SdkRetry);if((event.RequestType==="Create"||event.RequestType==="Update")&&(await createLogGroupSafe(logGroupName,logGroupRegion,retryOptions),await setRetentionPolicy(logGroupName,logGroupRegion,retryOptions,parseInt(event.ResourceProperties.RetentionInDays,10)),event.RequestType==="Create")){const region=process.env.AWS_REGION;await createLogGroupSafe(`/aws/lambda/${context.functionName}`,region,retryOptions),await setRetentionPolicy(`/aws/lambda/${context.functionName}`,region,retryOptions,1)}event.RequestType==="Delete"&&event.ResourceProperties.RemovalPolicy==="destroy"&&await deleteLogGroup(logGroupName,logGroupRegion,retryOptions),await respond("SUCCESS","OK",logGroupName)}catch(e){console.log(e),await respond("FAILED",e.message,event.ResourceProperties.LogGroupName)}function respond(responseStatus,reason,physicalResourceId){const responseBody=JSON.stringify({Status:responseStatus,Reason:reason,PhysicalResourceId:physicalResourceId,StackId:event.StackId,RequestId:event.RequestId,LogicalResourceId:event.LogicalResourceId,Data:{LogGroupName:event.ResourceProperties.LogGroupName}});console.log("Responding",responseBody);const parsedUrl=require("url").parse(event.ResponseURL),requestOptions={hostname:parsedUrl.hostname,path:parsedUrl.path,method:"PUT",headers:{"content-type":"","content-length":Buffer.byteLength(responseBody,"utf8")}};return new Promise((resolve,reject)=>{try{const request=require("https").request(requestOptions,resolve);request.on("error",reject),request.write(responseBody),request.end()}catch(e){reject(e)}})}function parseRetryOptions(rawOptions){const retryOptions={};return rawOptions&&(rawOptions.maxRetries&&(retryOptions.maxRetries=parseInt(rawOptions.maxRetries,10)),rawOptions.base&&(retryOptions.retryOptions={base:parseInt(rawOptions.base,10)})),retryOptions}}exports.handler=handler;
|
package/_temp/cdk.out
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"31.0.0"}
|