-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloudformationAuroraProvisionedSingleDB.yaml
3593 lines (3269 loc) · 127 KB
/
cloudformationAuroraProvisionedSingleDB.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
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
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
AWSTemplateFormatVersion: 2010-09-09
# File format follows https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-anatomy.html
# Tests:
# Lint: https://github.com/aws-cloudformation/cfn-python-lint
# Nag: https://github.com/stelligent/cfn_nag
# aws cloudformation validate-template: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cloudformation/validate-template.html
# This cloudformation template should be nearly identical to
# https://github.com/senzing-garage/aws-cloudformation-ecs-poc-simple
# But tailored to run use Senzing RPMs from the staging server.
Description: >-
Senzing aws-cloudformation-ecs-staging-simple-100M Version: 1.0.16
For more information see
https://github.com/senzing-garage/aws-cloudformation-ecs/tree/main/cloudformation/aws-cloudformation-ecs-staging-simple-100M
# -----------------------------------------------------------------------------
# Metadata
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
# -----------------------------------------------------------------------------
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Senzing installation
Parameters:
- AcceptEula
- RecordMax
- SenzingLicenseAsBase64
- Label:
default: Security
Parameters:
- CognitoAdminEmail
- CidrInbound
# - RunDataEncryption
- Label:
default: "Optional: Initial data load"
Parameters:
- RunStreamProducer
- Label:
default: Security responsibility
Parameters:
- SecurityResponsibility
ParameterLabels:
AcceptEula:
default: >-
Required: If you accept the Senzing End User License Agreement at
https://senzing.com/end-user-license-agreement,
enter 'I_ACCEPT_THE_SENZING_EULA'.
CidrInbound:
default: "Optional: Provide the permitted IP address block allowed to connect using CIDR notation."
CognitoAdminEmail:
default: "Required: Provide the email address for the administrative user."
RecordMax:
default: "Required: Number of records to insert."
RunStreamProducer:
default: "Optional: Would you like to have an initial set of data imported?"
# RunDataEncryption:
# default: "Optional: Would you like to run with data encryption enabled?"
SecurityResponsibility:
default: >-
Required: A default deployment of this template is for demonstration only.
Before using authentic PII, ensure the security of your deployment.
The security of this deployment is your responsibility.
To acknowledge your understanding and acceptance of the foregoing, type “I AGREE”.
SenzingLicenseAsBase64:
default: >-
The Senzing Evaluation comes with 100k free records of entity resolution.
If using more than 100k records, please input base 64 encoded license string.
# -----------------------------------------------------------------------------
# Parameters
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html
# -----------------------------------------------------------------------------
Parameters:
# AWS Console: https://console.aws.amazon.com/cloudformation/home?#/stacks > {stack} > Parameters
AcceptEula:
AllowedPattern: ".+|^I_ACCEPT_THE_SENZING_EULA$"
ConstraintDescription: AcceptEula parameter must be 'I_ACCEPT_THE_SENZING_EULA'
Default: "_"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#accepteula"
Type: String
CidrInbound:
AllowedPattern: '(?:\d{1,3}\.){3}\d{1,3}(?:/\d\d?)?'
ConstraintDescription: Inbound CIDR must be in the format n.n.n.n/n
MinLength: 9
MaxLength: 18
Default: 0.0.0.0/0
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#cidrinbound"
Type: String
CognitoAdminEmail:
AllowedPattern: '.+|^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$'
ConstraintDescription: Entering initial user email address is required to proceed
Default: "_"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#cognitoadminemail"
Type: String
RecordMax:
AllowedValues:
- "1"
- "1M"
- "5M"
- "10M"
- "20M"
- "25M"
- "50M"
- "75M"
- "100M"
Default: "20M"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#recordmax"
Type: String
RunStreamProducer:
AllowedValues:
- "No"
- "Yes"
Default: "Yes"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#runstreamproducer"
Type: String
# RunDataEncryption:
# AllowedValues:
# - "No"
# - "Yes"
# Default: "No"
# Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#rundataencryption"
# Type: String
SecurityResponsibility:
AllowedPattern: ".+|^I AGREE$"
ConstraintDescription: SecurityResponsibility parameter must be 'I AGREE'
Default: "_"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#securityresponsibility"
Type: String
SenzingLicenseAsBase64:
# AllowedPattern: ' ^$|[^-A-Za-z0-9+\/=\s]|=[^=]|={3,}$'
ConstraintDescription: "Must contain only Base64 characters. see https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#senzinglicenseasbase64"
Default: "_"
Description: "Help: https://hub.senzing.com/aws-cloudformation-ecs/aws-cloudformation-ecs-staging-simple-100M/#senzinglicenseasbase64"
Type: String
# -----------------------------------------------------------------------------
# Rules
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/rules-section-structure.html
# -----------------------------------------------------------------------------
Rules:
ConfirmCognitoAdminEmail:
Assertions:
- Assert: !Not
- !Equals
- !Ref CognitoAdminEmail
- "_"
AssertDescription: "Entering initial user email address is required to proceed"
ConfirmEula:
Assertions:
- Assert: !Not
- !Equals
- !Ref AcceptEula
- ""
AssertDescription: 'EULA needs to be accepted. Enter "I_ACCEPT_THE_SENZING_EULA"'
- Assert: !Equals
- !Ref AcceptEula
- I_ACCEPT_THE_SENZING_EULA
AssertDescription: 'EULA acceptance incorrect. Enter "I_ACCEPT_THE_SENZING_EULA"'
ConfirmSecurityResponsibility:
Assertions:
- Assert: !Equals
- !Ref SecurityResponsibility
- "I AGREE"
AssertDescription: 'Understanding responsibility and entering "I AGREE" is required to proceed.'
ConfirmSenzingLicenseAsBase64:
Assertions:
- Assert: !Not
- !Equals
- !Ref SenzingLicenseAsBase64
- "_"
AssertDescription: "Senzing license in base64 format is required."
# -----------------------------------------------------------------------------
# Mappings
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html
# -----------------------------------------------------------------------------
Mappings:
# DataEncryptionMap:
# "Yes":
# value: '
# "DATA_ENCRYPTION": {
# "ENCRYPTION_PLUGIN_NAME": "g2EncryptDataAES256CBC",
# "ENCRYPTION_KEY": "68402346802394406802620602396369",
# "ENCRYPTION_INITIALIZATION_VECTOR": "6432072349624624"
# },'
# "No":
# value: ""
RecordMaxMap:
"1":
value: "1"
"1M":
value: "1000000"
"5M":
value: "5000000"
"10M":
value: "10000000"
"20M":
value: "20000000"
"25M":
value: "25000000"
"50M":
value: "50000000"
"75M":
value: "75000000"
"100M":
value: "100000000"
Constants:
Database:
Name: G2
Username: senzing
Images:
# ApiServer: public.ecr.aws/senzing/senzing-poc-server:3.3.6
# InitPostgresql: public.ecr.aws/senzing/init-postgresql:1.1.6
# Redoer: public.ecr.aws/senzing/redoer:2.1.11
# SenzingApiTools: public.ecr.aws/senzing/senzingapi-tools:3.4.0
# Sshd: public.ecr.aws/senzing/sshd:1.4.9
# StreamLoader: public.ecr.aws/senzing/stream-loader:2.2.10
# StreamProducer: public.ecr.aws/senzing/stream-producer:1.8.4
# WebApp: public.ecr.aws/senzing/entity-search-web-app:2.7.4
# ApiServer: public.ecr.aws/senzing/senzing-poc-server:staging
InitDataEncryption: public.ecr.aws/senzing/data-encryption-aes256cbc-sample:1.0.5
# InitPostgresql: public.ecr.aws/senzing/init-postgresql:staging
# Redoer: public.ecr.aws/senzing/redoer:staging
# SenzingApiTools: public.ecr.aws/senzing/senzingapi-tools:staging
# Sshd: public.ecr.aws/senzing/sshd:staging
# StreamLoader: public.ecr.aws/senzing/stream-loader:staging
# StreamProducer: public.ecr.aws/senzing/stream-producer:1.8.3
# WebApp: public.ecr.aws/senzing/entity-search-web-app:2.7.3
ApiServer: public.ecr.aws/senzing/senzing-poc-server:staging
InitPostgresql: public.ecr.aws/senzing/init-postgresql:staging
Redoer: public.ecr.aws/senzing/sz_simple_redoer:staging
SenzingApiTools: public.ecr.aws/senzing/senzingapi-tools:staging
Sshd: public.ecr.aws/senzing/sshd:staging
StreamLoader: public.ecr.aws/senzing/sz_sqs_consumer:staging
StreamProducer: public.ecr.aws/senzing/stream-producer:1.8.7
WebApp: public.ecr.aws/senzing/entity-search-web-app:2.8.0
Run:
ApiServer: No
Redoer: Yes
Sshd: Yes
StreamLoader: Yes
WebApp: No
Stack:
Name: perf-prov
StreamProducer:
DataSource: TEST
EntityType: GENERIC
InputUrl: https://public-read-access.s3.amazonaws.com/TestDataSets/test-dataset-100m.json.gz
RecordMin: 0
# NOTE: The CIDRs for subnets may collide with existing subnets. The values may be altered.
VpcCidrs:
vpc:
cidr: 10.0.0.0/16
privsubnet1:
cidr: 10.0.10.0/22
privsubnet2:
cidr: 10.0.20.0/22
pubsubnet1:
cidr: 10.0.30.0/22
pubsubnet2:
cidr: 10.0.40.0/22
# -----------------------------------------------------------------------------
# Conditions
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html
# -----------------------------------------------------------------------------
Conditions:
IfRunApiServer: !Equals
- !FindInMap [Constants, Run, ApiServer]
- Yes
# IfRunDataEncryption: !Equals
# - !Ref RunDataEncryption
# - "Yes"
IfRunRedoer: !Equals
- !FindInMap [Constants, Run, Redoer]
- Yes
IfRunSshd: !Equals
- !FindInMap [Constants, Run, Sshd]
- Yes
IfRunStreamLoader: !Equals
- !FindInMap [Constants, Run, StreamLoader]
- Yes
IfRunStreamProducer: !Equals
- !Ref RunStreamProducer
- "Yes"
IfRunWebApp: !Equals
- !FindInMap [Constants, Run, WebApp]
- Yes
# -- Compound "if" conditions --------------------------------------------
IfUsingApiServer: !Or
- !Condition IfRunApiServer
- !Condition IfRunWebApp
IfUsingQueues: !Or
- !Condition IfRunStreamLoader
- !Condition IfRunStreamProducer
IfUsingWeb: !Or
- !Condition IfRunApiServer
- !Condition IfRunWebApp
# -----------------------------------------------------------------------------
# Resources
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html
# -----------------------------------------------------------------------------
Resources:
# -- Ssm -----------------------------------------------------------------
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html
# AWS Console: https://console.aws.amazon.com/systems-manager/parameters > Search for {stack}
SsmParameterSenzingEngineConfigurationJson:
Properties:
Name: !Sub "${AWS::StackName}-ssm-parameter-senzing-engine-configuration-json"
Type: String
Value: !GetAtt LambdaRunnerSenzingEngineConfigurationJson.ConfigJSON
Type: AWS::SSM::Parameter
# -- Iam -----------------------------------------------------------------
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-role.html
# AWS Console: https://console.aws.amazon.com/iam/home?#/roles > Search for {stack}
IamRoleApiServer:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
- sqs.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-api-server"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-api-server"
Type: AWS::IAM::Role
IamRoleDebug:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-debug"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-debug"
Type: AWS::IAM::Role
IamRoleG2ConfigTool:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-g2configtool"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-g2configtool"
Type: AWS::IAM::Role
IamRoleInitPostgres:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-init-postgres"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-init-postgres"
Type: AWS::IAM::Role
IamRoleLambda:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
- lambda.amazonaws.com
- route53.amazonaws.com
- sqs.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-lambda"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-lambda"
Type: AWS::IAM::Role
IamRoleRedoer:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-redoer"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-redoer"
Type: AWS::IAM::Role
IamRoleSshd:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-sshd"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-sshd"
Type: AWS::IAM::Role
IamRoleStreamLoader:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
- sqs.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-stream-loader"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-stream-loader"
Type: AWS::IAM::Role
IamRoleStreamProducer:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
- sqs.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-stream-producer"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-stream-producer"
Type: AWS::IAM::Role
IamRoleWebApp:
Properties:
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- ecs-tasks.amazonaws.com
Version: "2012-10-17"
Description: !Sub "${AWS::StackName}-iam-role-web-app"
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-iam-role-web-app"
Type: AWS::IAM::Role
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iam-policy.html
# AWS Console: https://console.aws.amazon.com/iam/home?#/roles > Search for {stack} > {role} > inline policy
IamPolicyCertificateManager:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-certificate-manager"
PolicyDocument:
Statement:
- Action:
- acm:ListCertificates
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicyCertificates:
Condition: IfUsingWeb
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-certificates"
PolicyDocument:
Statement:
- Action:
- iam:UploadServerCertificate
Effect: Allow
Resource:
- !GetAtt IamServerCertificate.Arn
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicyCognito:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-cognito"
PolicyDocument:
Statement:
- Action:
- cognito-idp:AdminCreateUser
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicyLoggingCreateStream:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-logging-create-stream"
PolicyDocument:
Statement:
- Action:
- logs:CreateLogStream
- logs:PutLogEvents
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleApiServer
- !Ref IamRoleG2ConfigTool
- !Ref IamRoleInitPostgres
- !Ref IamRoleLambda
- !Ref IamRoleRedoer
- !Ref IamRoleSshd
- !Ref IamRoleStreamLoader
- !Ref IamRoleStreamProducer
- !Ref IamRoleWebApp
Type: AWS::IAM::Policy
IamPolicyPassRole:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-pass-role"
PolicyDocument:
Statement:
- Action:
- iam:PassRole
Effect: Allow
Resource:
- !GetAtt IamRoleG2ConfigTool.Arn
- !GetAtt IamRoleLambda.Arn
- !GetAtt IamRoleStreamProducer.Arn
- !GetAtt IamRoleInitPostgres.Arn
Version: "2012-10-17"
Roles:
- !Ref IamRoleG2ConfigTool
- !Ref IamRoleLambda
- !Ref IamRoleStreamProducer
- !Ref IamRoleInitPostgres
Type: AWS::IAM::Policy
IamPolicyRds:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-rds"
PolicyDocument:
Statement:
- Action:
- rds:ModifyDBCluster
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicyRoute53:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-route53"
PolicyDocument:
Statement:
- Action:
- route53:GetHostedZone
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicyS3:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-s3"
PolicyDocument:
Statement:
- Action:
- s3:GetObject
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleLambda
Type: AWS::IAM::Policy
IamPolicySqsConsumer:
Condition: IfUsingQueues
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-sqs-consumer"
PolicyDocument:
Statement:
- Action:
- sqs:DeleteMessage
- sqs:GetQueueAttributes
- sqs:ReceiveMessage
Effect: Allow
Resource:
- !GetAtt SqsDeadLetter.Arn
- !GetAtt SqsInput.Arn
- !GetAtt SqsOutput.Arn
Version: "2012-10-17"
Roles:
- !Ref IamRoleStreamLoader
Type: AWS::IAM::Policy
IamPolicySqsProducer:
Condition: IfUsingQueues
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-sqs-producer"
PolicyDocument:
Statement:
- Action:
- sqs:SendMessage
- sqs:GetQueueAttributes
Effect: Allow
Resource:
- !GetAtt SqsDeadLetter.Arn
- !GetAtt SqsInput.Arn
- !GetAtt SqsOutput.Arn
Version: "2012-10-17"
Roles:
- !Ref IamRoleStreamLoader
- !Ref IamRoleStreamProducer
- !Ref IamRoleApiServer
Type: AWS::IAM::Policy
IamPolicyTaskRunner:
Properties:
PolicyName: !Sub "${AWS::StackName}-iam-policy-task-runner"
PolicyDocument:
Statement:
- Action:
- ecs:DescribeTasks
- ecs:RunTask
Effect: Allow
Resource:
- "*"
Version: "2012-10-17"
Roles:
- !Ref IamRoleApiServer
- !Ref IamRoleG2ConfigTool
- !Ref IamRoleLambda
- !Ref IamRoleRedoer
- !Ref IamRoleSshd
- !Ref IamRoleStreamLoader
- !Ref IamRoleWebApp
Type: AWS::IAM::Policy
# -- Logging ------------------------------------------------------------------
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html
# AWS Console: https://console.aws.amazon.com/cloudwatch/home?#logsV2:log-groups > Search for {stack}
LogsLogGroupDbClusterCore:
Properties:
LogGroupName: !Sub
- "/aws/rds/cluster/${StackNameAsLower}-aurora-senzing-core-cluster/postgresql"
- StackNameAsLower: !GetAtt LambdaRunnerStackNameAsLower.OutputString
Type: AWS::Logs::LogGroup
LogsLogGroupDbClusterLibfeat:
Properties:
LogGroupName: !Sub
- "/aws/rds/cluster/${StackNameAsLower}-aurora-senzing-libfeat-cluster/postgresql"
- StackNameAsLower: !GetAtt LambdaRunnerStackNameAsLower.OutputString
Type: AWS::Logs::LogGroup
LogsLogGroupDbClusterRes:
Properties:
LogGroupName: !Sub
- "/aws/rds/cluster/${StackNameAsLower}-aurora-senzing-res-cluster/postgresql"
- StackNameAsLower: !GetAtt LambdaRunnerStackNameAsLower.OutputString
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaCognitoCreateUser:
Condition: IfUsingWeb
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-cognito-create-user"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaGenerateCertificate:
Condition: IfUsingWeb
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-generate-certificate"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaRandomPassword:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-random-password"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaRandomString:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-random-string"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaRunTask:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-run-task"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaRunTaskAndWait:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-run-task-and-wait"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaSetRdbTimeoutAction:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-set-rdb-timeout-action"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaRunStreamProducerTasks:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-run-stream-producer-tasks"
Type: AWS::Logs::LogGroup
LogsLogGroupLambdaStringToLower:
Properties:
LogGroupName: !Sub "/aws/lambda/${AWS::StackName}-lambda-string-to-lower"
Type: AWS::Logs::LogGroup
LogsLogGroupMain:
Properties:
LogGroupName: !Sub
- "/senzing/${StackName}/${AWS::StackName}"
- StackName: !FindInMap [Constants, Stack, Name]
Type: AWS::Logs::LogGroup
# -- Cloud, subnets, routing --------------------------------------------------
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc.html
# AWS Console: https://console.aws.amazon.com/vpc/home?#vpcs > Search for {stack}
Ec2Vpc:
Properties:
CidrBlock: !FindInMap
- VpcCidrs
- vpc
- cidr
EnableDnsHostnames: true
EnableDnsSupport: true
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-vpc"
Type: AWS::EC2::VPC
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html
# AWS Console: https://console.aws.amazon.com/vpc/home?#subnets > Search for {stack}
Ec2SubnetPrivate1:
Properties:
AvailabilityZone: !Select
- "0"
- !GetAZs
Ref: AWS::Region
CidrBlock: !FindInMap
- VpcCidrs
- privsubnet1
- cidr
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-subnet-private-1"
VpcId: !Ref Ec2Vpc
Type: AWS::EC2::Subnet
Ec2SubnetPrivate2:
Properties:
AvailabilityZone: !Select
- "1"
- !GetAZs
Ref: AWS::Region
CidrBlock: !FindInMap
- VpcCidrs
- privsubnet2
- cidr
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-subnet-private-2"
VpcId: !Ref Ec2Vpc
Type: AWS::EC2::Subnet
Ec2SubnetPublic1:
Properties:
AvailabilityZone: !Select
- "0"
- !GetAZs
Ref: AWS::Region
CidrBlock: !FindInMap
- VpcCidrs
- pubsubnet1
- cidr
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-subnet-public-1"
VpcId: !Ref Ec2Vpc
Type: AWS::EC2::Subnet
Ec2SubnetPublic2:
Properties:
AvailabilityZone: !Select
- "1"
- !GetAZs
Ref: AWS::Region
CidrBlock: !FindInMap
- VpcCidrs
- pubsubnet2
- cidr
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-subnet-public-2"
VpcId: !Ref Ec2Vpc
Type: AWS::EC2::Subnet
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-eip.html
# AWS Console: https://console.aws.amazon.com/vpc/home?#Addresses: > Search for {stack}
Ec2Eip:
Properties:
Domain: vpc
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-eip"
Type: AWS::EC2::EIP
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-natgateway.html
# AWS Console: https://console.aws.amazon.com/vpc/home?#NatGateways: > Search for {stack}
Ec2NatGateway:
Properties:
AllocationId: !GetAtt Ec2Eip.AllocationId
SubnetId: !Ref Ec2SubnetPublic1
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-nat-gateway"
Type: AWS::EC2::NatGateway
# https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html
# AWS Console: https://console.aws.amazon.com/vpc/home?#SecurityGroups > Search for {stack}
Ec2SecurityGroupInternal:
Properties:
GroupDescription: !Sub "${AWS::StackName} - ECS internal open ports."
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0
Description: All
IpProtocol: "-1"
SecurityGroupIngress:
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: SSH
FromPort: 22
IpProtocol: tcp
ToPort: 22
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: HTTP
FromPort: 80
IpProtocol: tcp
ToPort: 80
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: HTTPS
FromPort: 443
IpProtocol: tcp
ToPort: 443
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: NFS
FromPort: 2049
IpProtocol: tcp
ToPort: 2049
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: PostgreSQL
FromPort: 5432
IpProtocol: tcp
ToPort: 5432
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: Senzing API server
FromPort: 8250
IpProtocol: tcp
ToPort: 8250
- CidrIp: !FindInMap
- VpcCidrs
- vpc
- cidr
Description: Senzing Web App
FromPort: 8251
IpProtocol: tcp
ToPort: 8251
Tags:
- Key: Name
Value: !Sub "${AWS::StackName}-ec2-security-group-internal"
VpcId: !Ref Ec2Vpc
Type: AWS::EC2::SecurityGroup
Ec2SecurityGroupLambdaRunner:
Properties:
GroupDescription: !Sub "${AWS::StackName} - Lambda open ports."
SecurityGroupEgress:
- CidrIp: 0.0.0.0/0