-
Notifications
You must be signed in to change notification settings - Fork 0
/
full-stack.yaml
631 lines (621 loc) · 19.6 KB
/
full-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
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
AWSTemplateFormatVersion: 2010-09-09
Description: Tyler Technologies Kong and Bastion Template
Parameters:
HostedZoneName:
Type: String
Description: Hosted Zone to add A records to
Default: ''
Subdomain:
Type: String
Description: Subdomain for the A record to create (i.e. dev)
Default: dev
DBName:
Default: kong
Description: The database name
Type: String
MinLength: '1'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: must begin with a letter and contain only alphanumeric characters
DBUsername:
Default: kong
Description: The database admin account username
Type: String
MinLength: '1'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: must begin with a letter and contain only alphanumeric characters
DBPassword:
Default: changeme
NoEcho: 'true'
Description: The database admin account password
Type: String
MinLength: '8'
DBClass:
Default: db.r5.xlarge
Description: Database instance class
Type: String
AllowedValues:
- db.t3.small
- db.t3.medium
- db.r5.large
- db.r5.xlarge
- db.r5.2xlarge
- db.r5.4xlarge
- db.r5.12xlarge
- db.r5.24xlarge
ConstraintDescription: must select a valid database instance type - dbclass
DBVersion:
Description: Postgres version
Type: String
Default: 9.6.16
AllowedValues:
- 9.6.16
- '10.11'
DBSnapshotIdentifier:
Description: Optional- The RDS snapshot name to restore to the new DB instance
Type: String
Default: ''
CollectorDBName:
Default: collector
Description: The database name
Type: String
MinLength: '1'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: must begin with a letter and contain only alphanumeric characters
CollectorDBHost:
Description: 'Optional- The database host dns, leave blank to start a new RDS instance'
Type: String
Default: ''
CollectorDBPort:
Default: '5432'
Description: Conditional- required if DBHost provided. The database port
Type: String
AllowedPattern: '[0-9]+'
ConstraintDescription: must be a valid port number
CollectorDBUsername:
Default: collector
Description: The database admin account username
Type: String
MinLength: '1'
AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
ConstraintDescription: must begin with a letter and contain only alphanumeric characters
CollectorDBPassword:
Default: changeme
NoEcho: 'true'
Description: The database admin account password
Type: String
MinLength: '8'
CollectorDBClass:
Default: db.r5.xlarge
Description: Database instance class
Type: String
AllowedValues:
- db.t3.small
- db.t3.medium
- db.r5.large
- db.r5.xlarge
- db.r5.2xlarge
- db.r5.4xlarge
- db.r5.12xlarge
- db.r5.24xlarge
ConstraintDescription: must select a valid database instance type
CollectorDBSnapshotIdentifier:
Description: Optional- The RDS snapshot name to restore to the new DB instance
Type: String
Default: ''
CacheClass:
Default: cache.r5.large
Description: Database instance class
Type: String
AllowedValues:
- cache.t3.micro
- cache.t3.small
- cache.t3.medium
- cache.m5.large
- cache.m5.xlarge
- cache.m5.2xlarge
- cache.m5.4xlarge
- cache.m5.12xlarge
- cache.r5.large
- cache.r5.xlarge
- cache.r5.2xlarge
- cache.r5.4xlarge
- cache.r5.12xlarge
ConstraintDescription: must select a valid database instance type
CacheNodeCount:
Description: Number of Redis Nodes
Type: Number
Default: '1'
MinValue: '1'
NumCacheClusters:
Description: Number of Redis Cache Clusters
Type: Number
Default: 2
MinValue: 2
MaxValue: 6
RedisPassword:
Description: Password to reach redis cache cluster
Type: String
NoEcho: 'true'
Default: changeme
KongAdminPassword:
Default: changeme
NoEcho: 'true'
Description: The kong_admin account password
Type: String
MinLength: '8'
KongEnterpriseAccount:
Description: Account name for logging into Kong Enterprise Bintray
Type: String
MinLength: '1'
Default: changeme
KongEnterprisePassword:
Description: Account password for logging into Kong Enterprise Bintray
Type: String
NoEcho: 'true'
MinLength: '1'
Default: changeme
KongEnterpriseLicensePath:
Description: Path to the license file in bintray
Type: String
Default: changeme
KongProxyAccess:
Description: The IP address range that can be used to access the Kong proxy port 8000
Type: String
MinLength: '9'
MaxLength: '18'
Default: 0.0.0.0/0
AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})'
ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x
KongAdminAccess:
Description: >-
The IP address range that can be used to access the Kong Admin port 8001
and 8002
Type: String
MinLength: '9'
MaxLength: '18'
Default: 0.0.0.0/0
AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})'
ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x
KongKeyName:
Description: >-
Required- Name of an existing EC2 KeyPair to enable SSH access to the
instances for Kong
Type: 'AWS::EC2::KeyPair::KeyName'
Default: ''
KongFleetMaxSize:
Description: Max Number of Kong instances
Type: Number
Default: '3'
MinValue: '1'
KongFleetDesiredSize:
Description: Desired Number of Kong instances
Type: Number
Default: '3'
MinValue: '1'
KongVersion:
Description: Kong version. Leave it blank to install latest version
Type: String
Default: 1.5.0.3
CollectorFleetMaxSize:
Description: Max Number of Kong Collector instances
Type: Number
Default: '2'
MinValue: '1'
CollectorFleetDesiredSize:
Description: Desired Number of Kong Collector instances
Type: Number
Default: '2'
MinValue: '1'
KongInstanceType:
Description: Kong EC2 instance type
Type: String
Default: c5n.large
AllowedValues:
- t3.micro
- t3.small
- t3.medium
- t3.large
- m5.large
- m5.xlarge
- m5.2xlarge
- m5.4xlarge
- m5.8xlarge
- c5.large
- c5.xlarge
- c5.2xlarge
- c5.4xlarge
- c5.9xlarge
- c5n.large
- c5n.xlarge
- c5n.2xlarge
- c5n.4xlarge
- c5n.9xlarge
- r5.large
- r5.xlarge
- r5.2xlarge
- r5.4xlarge
- r5.8xlarge
- r5n.large
- r5n.xlarge
- r5n.2xlarge
- r5n.4xlarge
- r5n.8xlarge
ConstraintDescription: must be a valid EC2 instance type
CollectorInstanceType:
Description: Kong Collector EC2 instance type
Type: String
Default: c5n.large
AllowedValues:
- t3.micro
- t3.small
- t3.medium
- t3.large
- m5.large
- m5.xlarge
- m5.2xlarge
- m5.4xlarge
- m5.8xlarge
- c5.large
- c5.xlarge
- c5.2xlarge
- c5.4xlarge
- c5.9xlarge
- c5n.large
- c5n.xlarge
- c5n.2xlarge
- c5n.4xlarge
- c5n.9xlarge
- r5.large
- r5.xlarge
- r5.2xlarge
- r5.4xlarge
- r5.8xlarge
- r5n.large
- r5n.xlarge
- r5n.2xlarge
- r5n.4xlarge
- r5n.8xlarge
ConstraintDescription: must be a valid EC2 instance type
KongBootstrapMigration:
Description: >-
Run the Kong bootstrap migrations by default, set it to false to disable
migrations
Type: String
Default: 'true'
AllowedValues:
- 'true'
- 'false'
KongTLSCertArn:
Description: Arn of ACM certificate to use on ALB
Type: String
Default: ''
SMTPHost:
Description: Host of the SMTP Server
Type: String
Default: ''
SMTPPort:
Description: Port of the SMTP Server
Type: Number
Default: '587'
SMTPStartTLS:
Description: Encrypt with STARTTLS (normally used with port 587)
Type: String
Default: 'on'
AllowedValues:
- 'on'
- 'off'
SMTPSSL:
Description: Encrypt with SSL (normally used with port 465)
Type: String
Default: 'off'
AllowedValues:
- 'on'
- 'off'
SMTPUsername:
Description: Username used for authentication with the SMTP server
Type: String
Default: ''
SMTPPassword:
Description: Password used for authentication with the SMTP server
Type: String
NoEcho: 'true'
Default: ''
SMTPAuthType:
Description: Authentication Type
Type: String
Default: plain
AllowedValues:
- plain
- login
- ''
SMTPDomain:
Description: The domain used in the EHLO connect and part of the Message-ID header
Type: String
Default: ''
SMTPAdminEmails:
Description: >-
Comma separated list of admin e-mail addresses: ex1@domain.com,
ex2@domain.com
Type: String
Default: ''
EmailsFrom:
Description: >-
The name and email address for the From header included in all
emails: Example Name <ex1@domain.com>
Type: String
Default: Kong Admin <admin@domain.com>
EmailsReplyTo:
Description: >-
The email address for the Reply-To header included in all emails
Type: String
Default: No Reply <no-reply@domain.com>
KongMemCacheSize:
Description: >-
Size of each of the two in-memory caches for database entities. The accepted
units are k and m, with a minimum recommended value of a few MBs
Type: String
Default: 1024m
PgMaxConcurrentQueries:
Description: >-
Sets the maximum number of concurrent queries that can be executing at any given
time. This limit is enforced per worker process; the total number of concurrent
queries for this node will be will be: pg_max_concurrent_queries * nginx_worker_processes.
The default value of 0 removes this concurrency limitation.
Type: String
Default: 0
PgbouncerInstanceType:
Description: Pgbouncer EC2 instance type
Type: String
Default: c5n.large
AllowedValues:
- t3.micro
- t3.small
- t3.medium
- t3.large
- m5.large
- m5.xlarge
- m5.2xlarge
- m5.4xlarge
- m5.8xlarge
- c5.large
- c5.xlarge
- c5.2xlarge
- c5.4xlarge
- c5.9xlarge
- c5n.large
- c5n.xlarge
- c5n.2xlarge
- c5n.4xlarge
- c5n.9xlarge
- r5.large
- r5.xlarge
- r5.2xlarge
- r5.4xlarge
- r5.8xlarge
- r5n.large
- r5n.xlarge
- r5n.2xlarge
- r5n.4xlarge
- r5n.8xlarge
ConstraintDescription: must be a valid EC2 instance type
PgbouncerFleetMaxSize:
Description: Max Number of Pgbouncer instances
Type: Number
Default: '3'
MinValue: '1'
PgbouncerFleetDesiredSize:
Description: Desired Number of Pgbouncer instances
Type: Number
Default: '3'
MinValue: '1'
UpdateDNS:
Description: Update DNS Records
Type: String
Default: 'true'
AllowedValues:
- 'true'
- 'false'
KongLogLevel:
Description: Log Level for Kong Nodes
Type: String
Default: warn
AllowedValues:
- debug
- info
- notice
- warn
- error
- crit
Conditions:
CreateDNSRecords: !Equals [ !Ref UpdateDNS, 'true' ]
Resources:
VPCStack:
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/foundation-vpc.yaml'
Tags:
- Key: resources
Value: vpc
DNSStack:
DependsOn: VPCStack
Condition: CreateDNSRecords
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/update-route53-recordset.yaml'
Parameters:
HostedZoneName: !Join ['', [!Ref HostedZoneName, '.']]
Subdomain: !Ref Subdomain
LoadBalancerDNSName: !GetAtt VPCStack.Outputs.PublicLoadBalancer
LoadBalancerHostedZoneId: !GetAtt VPCStack.Outputs.PublicLoadBalancerHostedZone
DBVpcStack:
DependsOn: VPCStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/foundation-vpc-db.yaml'
Parameters:
PublicSubnet1: !GetAtt VPCStack.Outputs.PublicSubnet1
PublicSubnet2: !GetAtt VPCStack.Outputs.PublicSubnet2
PublicSubnet3: !GetAtt VPCStack.Outputs.PublicSubnet3
SecurityGroup: !GetAtt VPCStack.Outputs.SecurityGroup
VPCID: !GetAtt VPCStack.Outputs.VPCID
Tags:
- Key: resources
Value: vpc-db
KongDBStack:
DependsOn: DBVpcStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/foundation-db.yaml'
Parameters:
DBName: !Ref DBName
DBUsername: !Ref DBUsername
DBPassword: !Ref DBPassword
DBClass: !Ref DBClass
DBVersion: !Ref DBVersion
DBSnapshotIdentifier: !Ref DBSnapshotIdentifier
DBSecurityGroup: !GetAtt DBVpcStack.Outputs.DBSecurityGroup
DBSubnetGroup: !GetAtt DBVpcStack.Outputs.DBSubnetGroup
EnableEnhancedMonitoring: true
Tags:
- Key: resources
Value: kong-db
CollectorDBStack:
DependsOn: DBVpcStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/foundation-db.yaml'
Parameters:
DBName: !Ref CollectorDBName
DBUsername: !Ref CollectorDBUsername
DBPassword: !Ref CollectorDBPassword
DBClass: !Ref CollectorDBClass
DBVersion: !Ref DBVersion
DBSnapshotIdentifier: !Ref CollectorDBSnapshotIdentifier
DBSecurityGroup: !GetAtt DBVpcStack.Outputs.DBSecurityGroup
DBSubnetGroup: !GetAtt DBVpcStack.Outputs.DBSubnetGroup
EnableEnhancedMonitoring: true
Tags:
- Key: resources
Value: collector-db
RedisStack:
DependsOn: DBVpcStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/foundation-redis-replication-cluster.yaml'
Parameters:
CacheClass: !Ref CacheClass
RedisPassword: !Ref RedisPassword
NumCacheClusters: !Ref NumCacheClusters
DBSecurityGroup: !GetAtt DBVpcStack.Outputs.DBSecurityGroup
PrivateSubnets: !Join [',', [!GetAtt VPCStack.Outputs.PrivateSubnet1, !GetAtt VPCStack.Outputs.PrivateSubnet2, !GetAtt VPCStack.Outputs.PrivateSubnet3]]
Tags:
- Key: resources
Value: redis
KongStack:
DependsOn:
- PGBouncerStack
- RedisStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/kong-enterprise.yaml'
Parameters:
VpcCidr: !GetAtt VPCStack.Outputs.Cidr
InternalLoadBalancer: !GetAtt VPCStack.Outputs.InternalLoadBalancer
PublicLoadBalancer: !GetAtt VPCStack.Outputs.PublicLoadBalancer
InternalLoadBalancerARN: !GetAtt VPCStack.Outputs.InternalLoadBalancerARN
PublicLoadBalancerARN: !GetAtt VPCStack.Outputs.PublicLoadBalancerARN
DBName: !Ref DBName
DBHost: !GetAtt VPCStack.Outputs.InternalLoadBalancer
DBPort: 6432
DBUsername: !Ref DBUsername
DBPassword: !Ref DBPassword
CollectorDBName: !Ref CollectorDBName
CollectorDBHost: !GetAtt VPCStack.Outputs.InternalLoadBalancer
CollectorDBPort: 6432
CollectorDBUsername: !Ref CollectorDBUsername
CollectorDBPassword: !Ref CollectorDBPassword
KongAdminPassword: !Ref KongAdminPassword
KongEnterpriseAccount: !Ref KongEnterpriseAccount
KongEnterprisePassword: !Ref KongEnterprisePassword
KongEnterpriseLicensePath: !Ref KongEnterpriseLicensePath
KongKeyName: !Ref KongKeyName
KongFleetMaxSize: !Ref KongFleetMaxSize
KongFleetDesiredSize: !Ref KongFleetDesiredSize
KongVersion: !Ref KongVersion
CollectorFleetMaxSize: !Ref CollectorFleetMaxSize
CollectorFleetDesiredSize: !Ref CollectorFleetDesiredSize
KongInstanceType: !Ref KongInstanceType
CollectorInstanceType: !Ref CollectorInstanceType
KongBootstrapMigration: !Ref KongBootstrapMigration
KongTLSCertArn: !Ref KongTLSCertArn
KongUrl: !Join ['.', [!Ref Subdomain, !Ref HostedZoneName]]
SMTPHost: !Ref SMTPHost
SMTPPort: !Ref SMTPPort
SMTPStartTLS: !Ref SMTPStartTLS
SMTPSSL: !Ref SMTPSSL
SMTPUsername: !Ref SMTPUsername
SMTPPassword: !Ref SMTPPassword
SMTPAuthType: !Ref SMTPAuthType
SMTPDomain: !Ref SMTPDomain
SMTPAdminEmails: !Ref SMTPAdminEmails
EmailsFrom: !Ref EmailsFrom
EmailsReplyTo: !Ref EmailsReplyTo
KongMemCacheSize: !Ref KongMemCacheSize
PgMaxConcurrentQueries: !Ref PgMaxConcurrentQueries
PrivateSubnets: !Join [',', [!GetAtt VPCStack.Outputs.PrivateSubnet1, !GetAtt VPCStack.Outputs.PrivateSubnet2, !GetAtt VPCStack.Outputs.PrivateSubnet3]]
PrivateSubnetAZs: !Join [',', [!GetAtt VPCStack.Outputs.PrivateSubnet1AZ, !GetAtt VPCStack.Outputs.PrivateSubnet2AZ, !GetAtt VPCStack.Outputs.PrivateSubnet3AZ]]
KongSecurityGroup: !GetAtt VPCStack.Outputs.SecurityGroup
LoadBalancerSecurityGroup: !GetAtt VPCStack.Outputs.LoadBalancerSecurityGroup
RedisEndpointAddress: !GetAtt RedisStack.Outputs.RedisHost
RedisEndpointPort: !GetAtt RedisStack.Outputs.RedisPort
RedisPassword: !Ref RedisPassword
VPCID: !GetAtt VPCStack.Outputs.VPCID
KongLogLevel: !Ref KongLogLevel
Tags:
- Key: resources
Value: kong
BastionStack:
DependsOn: VPCStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/linux-bastion.yaml'
Parameters:
PublicSubnet1ID: !GetAtt VPCStack.Outputs.PublicSubnet1
PublicSubnet2ID: !GetAtt VPCStack.Outputs.PublicSubnet2
VPCID: !GetAtt VPCStack.Outputs.VPCID
KeyPairName: !Ref KongKeyName
KongSecurityGroupId: !GetAtt VPCStack.Outputs.SecurityGroup
Tags:
- Key: resources
Value: bastion
PGBouncerStack:
DependsOn:
- KongDBStack
- CollectorDBStack
Type: 'AWS::CloudFormation::Stack'
Properties:
TemplateURL: 'https://<URI_to_S3_bucket>/templates/pgbouncer.yaml'
Parameters:
VpcCidr: !GetAtt VPCStack.Outputs.Cidr
InternalLoadBalancerARN: !GetAtt VPCStack.Outputs.InternalLoadBalancerARN
PrivateSubnets: !Join [',', [!GetAtt VPCStack.Outputs.PrivateSubnet1, !GetAtt VPCStack.Outputs.PrivateSubnet2, !GetAtt VPCStack.Outputs.PrivateSubnet3]]
PrivateSubnetAZs: !Join [',', [!GetAtt VPCStack.Outputs.PrivateSubnet1AZ, !GetAtt VPCStack.Outputs.PrivateSubnet2AZ, !GetAtt VPCStack.Outputs.PrivateSubnet3AZ]]
SecurityGroup: !GetAtt VPCStack.Outputs.SecurityGroup
VPCID: !GetAtt VPCStack.Outputs.VPCID
DBName: !Ref DBName
DBHost: !GetAtt KongDBStack.Outputs.EndpointAddress
DBPort: !GetAtt KongDBStack.Outputs.EndpointPort
DBUsername: !Ref DBUsername
DBPassword: !Ref DBPassword
CollectorDBName: !Ref CollectorDBName
CollectorDBHost: !GetAtt CollectorDBStack.Outputs.EndpointAddress
CollectorDBPort: !GetAtt CollectorDBStack.Outputs.EndpointPort
CollectorDBUsername: !Ref CollectorDBUsername
CollectorDBPassword: !Ref CollectorDBPassword
KeyName: !Ref KongKeyName
FleetMaxSize: !Ref PgbouncerFleetMaxSize
FleetDesiredSize: !Ref PgbouncerFleetDesiredSize
InstanceType: !Ref PgbouncerInstanceType
Tags:
- Key: resources
Value: pgbouncer