-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstackoutput.yaml
More file actions
788 lines (787 loc) · 26.2 KB
/
stackoutput.yaml
File metadata and controls
788 lines (787 loc) · 26.2 KB
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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
Resources:
MyVpcF9F0CA6F:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsHostnames: true
EnableDnsSupport: true
InstanceTenancy: default
Tags:
- Key: Name
Value: faropt/MyVpc
Metadata:
aws:cdk:path: faropt/MyVpc/Resource
MyVpcPublicSubnet1SubnetF6608456:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.0.0/18
VpcId:
Ref: MyVpcF9F0CA6F
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: ""
MapPublicIpOnLaunch: true
Tags:
- Key: aws-cdk:subnet-name
Value: Public
- Key: aws-cdk:subnet-type
Value: Public
- Key: Name
Value: faropt/MyVpc/PublicSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/Subnet
MyVpcPublicSubnet1RouteTableC46AB2F4:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVpcF9F0CA6F
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/RouteTable
MyVpcPublicSubnet1RouteTableAssociation2ECEE1CB:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVpcPublicSubnet1RouteTableC46AB2F4
SubnetId:
Ref: MyVpcPublicSubnet1SubnetF6608456
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/RouteTableAssociation
MyVpcPublicSubnet1DefaultRoute95FDF9EB:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVpcPublicSubnet1RouteTableC46AB2F4
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: MyVpcIGW5C4A4F63
DependsOn:
- MyVpcVPCGW488ACE0D
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/DefaultRoute
MyVpcPublicSubnet1EIP096967CB:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/EIP
MyVpcPublicSubnet1NATGatewayAD3400C1:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt:
- MyVpcPublicSubnet1EIP096967CB
- AllocationId
SubnetId:
Ref: MyVpcPublicSubnet1SubnetF6608456
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet1/NATGateway
MyVpcPublicSubnet2Subnet492B6BFB:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.64.0/18
VpcId:
Ref: MyVpcF9F0CA6F
AvailabilityZone:
Fn::Select:
- 1
- Fn::GetAZs: ""
MapPublicIpOnLaunch: true
Tags:
- Key: aws-cdk:subnet-name
Value: Public
- Key: aws-cdk:subnet-type
Value: Public
- Key: Name
Value: faropt/MyVpc/PublicSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/Subnet
MyVpcPublicSubnet2RouteTable1DF17386:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVpcF9F0CA6F
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/RouteTable
MyVpcPublicSubnet2RouteTableAssociation227DE78D:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVpcPublicSubnet2RouteTable1DF17386
SubnetId:
Ref: MyVpcPublicSubnet2Subnet492B6BFB
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/RouteTableAssociation
MyVpcPublicSubnet2DefaultRoute052936F6:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVpcPublicSubnet2RouteTable1DF17386
DestinationCidrBlock: 0.0.0.0/0
GatewayId:
Ref: MyVpcIGW5C4A4F63
DependsOn:
- MyVpcVPCGW488ACE0D
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/DefaultRoute
MyVpcPublicSubnet2EIP8CCBA239:
Type: AWS::EC2::EIP
Properties:
Domain: vpc
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/EIP
MyVpcPublicSubnet2NATGateway91BFBEC9:
Type: AWS::EC2::NatGateway
Properties:
AllocationId:
Fn::GetAtt:
- MyVpcPublicSubnet2EIP8CCBA239
- AllocationId
SubnetId:
Ref: MyVpcPublicSubnet2Subnet492B6BFB
Tags:
- Key: Name
Value: faropt/MyVpc/PublicSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PublicSubnet2/NATGateway
MyVpcPrivateSubnet1Subnet5057CF7E:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.128.0/18
VpcId:
Ref: MyVpcF9F0CA6F
AvailabilityZone:
Fn::Select:
- 0
- Fn::GetAZs: ""
MapPublicIpOnLaunch: false
Tags:
- Key: aws-cdk:subnet-name
Value: Private
- Key: aws-cdk:subnet-type
Value: Private
- Key: Name
Value: faropt/MyVpc/PrivateSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet1/Subnet
MyVpcPrivateSubnet1RouteTable8819E6E2:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVpcF9F0CA6F
Tags:
- Key: Name
Value: faropt/MyVpc/PrivateSubnet1
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet1/RouteTable
MyVpcPrivateSubnet1RouteTableAssociation56D38C7E:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVpcPrivateSubnet1RouteTable8819E6E2
SubnetId:
Ref: MyVpcPrivateSubnet1Subnet5057CF7E
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet1/RouteTableAssociation
MyVpcPrivateSubnet1DefaultRouteA8CDE2FA:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVpcPrivateSubnet1RouteTable8819E6E2
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: MyVpcPublicSubnet1NATGatewayAD3400C1
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet1/DefaultRoute
MyVpcPrivateSubnet2Subnet0040C983:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.192.0/18
VpcId:
Ref: MyVpcF9F0CA6F
AvailabilityZone:
Fn::Select:
- 1
- Fn::GetAZs: ""
MapPublicIpOnLaunch: false
Tags:
- Key: aws-cdk:subnet-name
Value: Private
- Key: aws-cdk:subnet-type
Value: Private
- Key: Name
Value: faropt/MyVpc/PrivateSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet2/Subnet
MyVpcPrivateSubnet2RouteTableCEDCEECE:
Type: AWS::EC2::RouteTable
Properties:
VpcId:
Ref: MyVpcF9F0CA6F
Tags:
- Key: Name
Value: faropt/MyVpc/PrivateSubnet2
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet2/RouteTable
MyVpcPrivateSubnet2RouteTableAssociation86A610DA:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId:
Ref: MyVpcPrivateSubnet2RouteTableCEDCEECE
SubnetId:
Ref: MyVpcPrivateSubnet2Subnet0040C983
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet2/RouteTableAssociation
MyVpcPrivateSubnet2DefaultRoute9CE96294:
Type: AWS::EC2::Route
Properties:
RouteTableId:
Ref: MyVpcPrivateSubnet2RouteTableCEDCEECE
DestinationCidrBlock: 0.0.0.0/0
NatGatewayId:
Ref: MyVpcPublicSubnet2NATGateway91BFBEC9
Metadata:
aws:cdk:path: faropt/MyVpc/PrivateSubnet2/DefaultRoute
MyVpcIGW5C4A4F63:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: faropt/MyVpc
Metadata:
aws:cdk:path: faropt/MyVpc/IGW
MyVpcVPCGW488ACE0D:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId:
Ref: MyVpcF9F0CA6F
InternetGatewayId:
Ref: MyVpcIGW5C4A4F63
Metadata:
aws:cdk:path: faropt/MyVpc/VPCGW
faroptlogGroup82758D11:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: faroptlogGroup
RetentionInDays: 731
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: faropt/faroptlogGroup/Resource
ECSExecutionRoleA044C6CA:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: ecs-tasks.amazonaws.com
Version: "2012-10-17"
Metadata:
aws:cdk:path: faropt/ECSExecutionRole/Resource
ECSExecutionRoleDefaultPolicy91A8E3CE:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
Effect: Allow
Resource:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":ecr:"
- Ref: AWS::Region
- ":"
- Ref: AWS::AccountId
- :repository/aws-cdk/assets
- Action: ecr:GetAuthorizationToken
Effect: Allow
Resource: "*"
- Action:
- logs:CreateLogStream
- logs:PutLogEvents
Effect: Allow
Resource:
Fn::GetAtt:
- faroptlogGroup82758D11
- Arn
Version: "2012-10-17"
PolicyName: ECSExecutionRoleDefaultPolicy91A8E3CE
Roles:
- Ref: ECSExecutionRoleA044C6CA
Metadata:
aws:cdk:path: faropt/ECSExecutionRole/DefaultPolicy/Resource
ECSExecutionPolicy30B4C38F:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- ecr:BatchCheckLayerAvailability
- ecr:GetDownloadUrlForLayer
- ecr:BatchGetImage
- ecr:GetAuthorizationToken
- logs:CreateLogStream
- logs:PutLogEvents
- sagemaker:*
- s3:*
- cloudwatch:PutMetricData
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: ECSExecutionPolicy
Roles:
- Ref: ECSExecutionRoleA044C6CA
Metadata:
aws:cdk:path: faropt/ECSExecutionPolicy/Resource
FarOptCluster5E6855FD:
Type: AWS::ECS::Cluster
Properties:
ClusterName: FarOptCluster
Metadata:
aws:cdk:path: faropt/FarOptCluster/Resource
FarOptClusterDefaultServiceDiscoveryNamespace4D0234E9:
Type: AWS::ServiceDiscovery::PrivateDnsNamespace
Properties:
Name: local-faropt
Vpc:
Ref: MyVpcF9F0CA6F
Metadata:
aws:cdk:path: faropt/FarOptCluster/DefaultServiceDiscoveryNamespace/Resource
s3bucketFBFA637E:
Type: AWS::S3::Bucket
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: faropt/s3bucket/Resource
s3bucketNotifications7E3FF01B:
Type: Custom::S3BucketNotifications
Properties:
ServiceToken:
Fn::GetAtt:
- BucketNotificationsHandler050a0587b7544547bf325f094a3db8347ECC3691
- Arn
BucketName:
Ref: s3bucketFBFA637E
NotificationConfiguration:
LambdaFunctionConfigurations:
- Events:
- s3:ObjectCreated:*
LambdaFunctionArn:
Fn::GetAtt:
- lambdafunction45C982D3
- Arn
DependsOn:
- lambdafunctionAllowBucketNotificationsFromfaropts3bucket9A5DDA68CA498F12
Metadata:
aws:cdk:path: faropt/s3bucket/Notifications/Resource
FaroptJobTable149A8B97:
Type: AWS::DynamoDB::Table
Properties:
KeySchema:
- AttributeName: jobid
KeyType: HASH
AttributeDefinitions:
- AttributeName: jobid
AttributeType: S
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
TableName: FaroptJobTable
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: faropt/FaroptJobTable/Resource
FaroptRecipeTable80E59E42:
Type: AWS::DynamoDB::Table
Properties:
KeySchema:
- AttributeName: recipeid
KeyType: HASH
AttributeDefinitions:
- AttributeName: recipeid
AttributeType: S
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
TableName: FaroptRecipeTable
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: faropt/FaroptRecipeTable/Resource
taskDefinitionScheduler2F1AF045:
Type: AWS::ECS::TaskDefinition
Properties:
ContainerDefinitions:
- Cpu: 4096
Environment:
- Name: s3bucket
Value:
Ref: s3bucketFBFA637E
Essential: true
Image:
Fn::Join:
- ""
- - Ref: AWS::AccountId
- .dkr.ecr.
- Ref: AWS::Region
- "."
- Ref: AWS::URLSuffix
- /aws-cdk/assets:b73eb903d24a8e95dd8d93b1c864db113e55df3713a6d2589dca0b4ddcb837cb
LogConfiguration:
LogDriver: awslogs
Options:
awslogs-group:
Ref: faroptlogGroup82758D11
awslogs-stream-prefix: faroptlogs
awslogs-region:
Ref: AWS::Region
Memory: 8192
MemoryReservation: 8192
Name: FarOptImage
Cpu: "4096"
ExecutionRoleArn:
Fn::GetAtt:
- ECSExecutionRoleA044C6CA
- Arn
Family: Faropt-Scheduler
Memory: "8192"
NetworkMode: awsvpc
RequiresCompatibilities:
- FARGATE
TaskRoleArn:
Fn::GetAtt:
- ECSExecutionRoleA044C6CA
- Arn
Metadata:
aws:cdk:path: faropt/taskDefinitionScheduler/Resource
lambdafunctionServiceRole85538ADB:
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: faropt/lambda_function/ServiceRole/Resource
lambdafunctionServiceRoleDefaultPolicyC6E2CA6E:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- ecs:RunTask
- ecs:PutAccountSetting
- s3:*
- iam:PassRole
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: lambdafunctionServiceRoleDefaultPolicyC6E2CA6E
Roles:
- Ref: lambdafunctionServiceRole85538ADB
Metadata:
aws:cdk:path: faropt/lambda_function/ServiceRole/DefaultPolicy/Resource
lambdafunction45C982D3:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Ref: AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cS3Bucket3DA82515
S3Key:
Fn::Join:
- ""
- - Fn::Select:
- 0
- Fn::Split:
- "||"
- Ref: AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cS3VersionKeyA5530601
- Fn::Select:
- 1
- Fn::Split:
- "||"
- Ref: AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cS3VersionKeyA5530601
Handler: lambda-handler.main
Role:
Fn::GetAtt:
- lambdafunctionServiceRole85538ADB
- Arn
Runtime: python3.7
Environment:
Variables:
cluster_name:
Ref: FarOptCluster5E6855FD
launch_type: FARGATE
task_definition: faropt/taskDefinitionScheduler
task_family: Faropt-Scheduler
subnet1:
Ref: MyVpcPrivateSubnet1Subnet5057CF7E
subnet2:
Ref: MyVpcPrivateSubnet2Subnet0040C983
bucket:
Ref: s3bucketFBFA637E
DependsOn:
- lambdafunctionServiceRoleDefaultPolicyC6E2CA6E
- lambdafunctionServiceRole85538ADB
Metadata:
aws:cdk:path: faropt/lambda_function/Resource
aws:asset:path: asset.4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158c
aws:asset:property: Code
lambdafunctionAllowBucketNotificationsFromfaropts3bucket9A5DDA68CA498F12:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::GetAtt:
- lambdafunction45C982D3
- Arn
Principal: s3.amazonaws.com
SourceAccount:
Ref: AWS::AccountId
SourceArn:
Fn::GetAtt:
- s3bucketFBFA637E
- Arn
Metadata:
aws:cdk:path: faropt/lambda_function/AllowBucketNotificationsFromfaropts3bucket9A5DDA68
BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleB6FB88EC:
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: faropt/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/Resource
BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleDefaultPolicy2CF63D36:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action: s3:PutBucketNotification
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleDefaultPolicy2CF63D36
Roles:
- Ref: BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleB6FB88EC
Metadata:
aws:cdk:path: faropt/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Role/DefaultPolicy/Resource
BucketNotificationsHandler050a0587b7544547bf325f094a3db8347ECC3691:
Type: AWS::Lambda::Function
Properties:
Description: AWS CloudFormation handler for "Custom::S3BucketNotifications" resources (@aws-cdk/aws-s3)
Code:
ZipFile: >-
exports.handler = (event, context) => {
// eslint-disable-next-line @typescript-eslint/no-require-imports, import/no-extraneous-dependencies
const s3 = new (require('aws-sdk').S3)();
// eslint-disable-next-line @typescript-eslint/no-require-imports
const https = require('https');
// eslint-disable-next-line @typescript-eslint/no-require-imports
const url = require('url');
log(JSON.stringify(event, undefined, 2));
const props = event.ResourceProperties;
if (event.RequestType === 'Delete') {
props.NotificationConfiguration = {}; // this is how you clean out notifications
}
const req = {
Bucket: props.BucketName,
NotificationConfiguration: props.NotificationConfiguration,
};
return s3.putBucketNotificationConfiguration(req, (err, data) => {
log({ err, data });
if (err) {
return submitResponse('FAILED', err.message + `\nMore information in CloudWatch Log Stream: ${context.logStreamName}`);
}
else {
return submitResponse('SUCCESS');
}
});
function log(obj) {
console.error(event.RequestId, event.StackId, event.LogicalResourceId, obj);
}
// eslint-disable-next-line max-len
// adapted from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-function-code.html#cfn-lambda-function-code-cfnresponsemodule
// to allow sending an error messge as a reason.
function submitResponse(responseStatus, reason) {
const responseBody = JSON.stringify({
Status: responseStatus,
Reason: reason || 'See the details in CloudWatch Log Stream: ' + context.logStreamName,
PhysicalResourceId: event.PhysicalResourceId || event.LogicalResourceId,
StackId: event.StackId,
RequestId: event.RequestId,
LogicalResourceId: event.LogicalResourceId,
NoEcho: false,
});
log({ responseBody });
const parsedUrl = url.parse(event.ResponseURL);
const options = {
hostname: parsedUrl.hostname,
port: 443,
path: parsedUrl.path,
method: 'PUT',
headers: {
'content-type': '',
'content-length': responseBody.length,
},
};
const request = https.request(options, (r) => {
log({ statusCode: r.statusCode, statusMessage: r.statusMessage });
context.done();
});
request.on('error', (error) => {
log({ sendError: error });
context.done();
});
request.write(responseBody);
request.end();
}
};
Handler: index.handler
Role:
Fn::GetAtt:
- BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleB6FB88EC
- Arn
Runtime: nodejs10.x
Timeout: 300
DependsOn:
- BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleDefaultPolicy2CF63D36
- BucketNotificationsHandler050a0587b7544547bf325f094a3db834RoleB6FB88EC
Metadata:
aws:cdk:path: faropt/BucketNotificationsHandler050a0587b7544547bf325f094a3db834/Resource
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Modules: aws-cdk=1.74.0,@aws-cdk/assets=1.56.0,@aws-cdk/aws-apigateway=1.56.0,@aws-cdk/aws-applicationautoscaling=1.56.0,@aws-cdk/aws-autoscaling=1.56.0,@aws-cdk/aws-autoscaling-common=1.56.0,@aws-cdk/aws-autoscaling-hooktargets=1.56.0,@aws-cdk/aws-certificatemanager=1.56.0,@aws-cdk/aws-cloudformation=1.56.0,@aws-cdk/aws-cloudfront=1.56.0,@aws-cdk/aws-cloudwatch=1.56.0,@aws-cdk/aws-codeguruprofiler=1.56.0,@aws-cdk/aws-cognito=1.56.0,@aws-cdk/aws-dynamodb=1.56.0,@aws-cdk/aws-ec2=1.56.0,@aws-cdk/aws-ecr=1.56.0,@aws-cdk/aws-ecr-assets=1.56.0,@aws-cdk/aws-ecs=1.56.0,@aws-cdk/aws-efs=1.56.0,@aws-cdk/aws-elasticloadbalancing=1.56.0,@aws-cdk/aws-elasticloadbalancingv2=1.56.0,@aws-cdk/aws-events=1.56.0,@aws-cdk/aws-iam=1.56.0,@aws-cdk/aws-kms=1.56.0,@aws-cdk/aws-lambda=1.56.0,@aws-cdk/aws-logs=1.56.0,@aws-cdk/aws-route53=1.56.0,@aws-cdk/aws-route53-targets=1.56.0,@aws-cdk/aws-s3=1.56.0,@aws-cdk/aws-s3-assets=1.56.0,@aws-cdk/aws-s3-notifications=1.56.0,@aws-cdk/aws-sam=1.56.0,@aws-cdk/aws-secretsmanager=1.56.0,@aws-cdk/aws-servicediscovery=1.56.0,@aws-cdk/aws-sns=1.56.0,@aws-cdk/aws-sns-subscriptions=1.56.0,@aws-cdk/aws-sqs=1.56.0,@aws-cdk/aws-ssm=1.56.0,@aws-cdk/cloud-assembly-schema=1.56.0,@aws-cdk/core=1.56.0,@aws-cdk/custom-resources=1.56.0,@aws-cdk/cx-api=1.56.0,@aws-cdk/region-info=1.56.0,jsii-runtime=Python/3.6.11
Condition: CDKMetadataAvailable
Parameters:
AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cS3Bucket3DA82515:
Type: String
Description: S3 bucket for asset "4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158c"
AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cS3VersionKeyA5530601:
Type: String
Description: S3 key for asset version "4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158c"
AssetParameters4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158cArtifactHash49090DF4:
Type: String
Description: Artifact hash for asset "4b6bf88ce4fd3e5943d206b3300f8d5846e09675d09aae093934d92df866158c"
Outputs:
s3output:
Value:
Ref: s3bucketFBFA637E
Export:
Name: bucket
jobtable:
Value:
Ref: FaroptJobTable149A8B97
Export:
Name: jobtable
recipetable:
Value:
Ref: FaroptRecipeTable80E59E42
Export:
Name: recipetable
Conditions:
CDKMetadataAvailable:
Fn::Or:
- Fn::Or:
- 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::Equals:
- Ref: AWS::Region
- eu-central-1
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- eu-north-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::Equals:
- Ref: AWS::Region
- us-west-1
- Fn::Equals:
- Ref: AWS::Region
- us-west-2