AnimeshShaw commited on
Commit
effd2fb
·
1 Parent(s): e1beced

Add human_reference_dataset/aws-cloudformation-templates/EKS/

Browse files
human_reference_dataset/aws-cloudformation-templates/EKS/README.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EKS on EC2
2
+
3
+ ## Features
4
+
5
+ - EKS cluster on EC2
6
+
7
+ ## Configuration diagram
8
+
9
+ ![diagram](./eks_ec2_diagram.png)
10
+
11
+ ## After creating the stack
12
+
13
+ - Apply manifest.yml to the eks cluster.
14
+
15
+ ## Before delete the stack
16
+
17
+ - Delete the pod and service created.
human_reference_dataset/aws-cloudformation-templates/EKS/eks_ec2_diagram.png ADDED

Git LFS Details

  • SHA256: b1e40ed7b0cf761df399b091228f0928aae28992c530552d41b311fda3ed5cae
  • Pointer size: 131 Bytes
  • Size of remote file: 145 kB
human_reference_dataset/aws-cloudformation-templates/EKS/manifest.yml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ apiVersion: apps/v1
3
+ kind: Deployment
4
+ metadata:
5
+ name: nginx
6
+ spec:
7
+ selector:
8
+ matchLabels:
9
+ app: nginx
10
+ replicas: 2
11
+ template:
12
+ metadata:
13
+ labels:
14
+ app: nginx
15
+ spec:
16
+ containers:
17
+ - image: nginx
18
+ name: nginx
19
+ ports:
20
+ - containerPort: 80
21
+ ---
22
+ apiVersion: v1
23
+ kind: Service
24
+ metadata:
25
+ name: nginx
26
+ spec:
27
+ type: LoadBalancer
28
+ selector:
29
+ app: nginx
30
+ ports:
31
+ - port: 80
32
+ targetPort: 80
33
+ protocol: TCP
human_reference_dataset/aws-cloudformation-templates/EKS/template.json ADDED
@@ -0,0 +1,885 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "AWSTemplateFormatVersion": "2010-09-09",
3
+ "Description": "AWS CloudFormation Sample Template EKS Cluster on EC2",
4
+ "Metadata": {
5
+ "AWS::CloudFormation::Interface": {
6
+ "ParameterGroups": [
7
+ {
8
+ "Label": {
9
+ "default": "Parameters"
10
+ },
11
+ "Parameters": [
12
+ "VPCCidrBlock",
13
+ "PublicCidrBlock1",
14
+ "PublicCidrBlock2",
15
+ "PublicCidrBlock3",
16
+ "PrivateCidrBlock1",
17
+ "PrivateCidrBlock2",
18
+ "PrivateCidrBlock3",
19
+ "EKSClusterVersion",
20
+ "NodeGroupInstanceTypes"
21
+ ]
22
+ }
23
+ ]
24
+ }
25
+ },
26
+ "Parameters": {
27
+ "VPCCidrBlock": {
28
+ "Type": "String",
29
+ "Default": "10.0.0.0/16"
30
+ },
31
+ "PublicCidrBlock1": {
32
+ "Type": "String",
33
+ "Default": "10.0.1.0/24"
34
+ },
35
+ "PublicCidrBlock2": {
36
+ "Type": "String",
37
+ "Default": "10.0.2.0/24"
38
+ },
39
+ "PublicCidrBlock3": {
40
+ "Type": "String",
41
+ "Default": "10.0.3.0/24"
42
+ },
43
+ "PrivateCidrBlock1": {
44
+ "Type": "String",
45
+ "Default": "10.0.4.0/24"
46
+ },
47
+ "PrivateCidrBlock2": {
48
+ "Type": "String",
49
+ "Default": "10.0.5.0/24"
50
+ },
51
+ "PrivateCidrBlock3": {
52
+ "Type": "String",
53
+ "Default": "10.0.6.0/24"
54
+ },
55
+ "EKSClusterVersion": {
56
+ "Type": "String"
57
+ },
58
+ "NodeGroupInstanceTypes": {
59
+ "Type": "String",
60
+ "Default": "t3.medium"
61
+ }
62
+ },
63
+ "Mappings": {
64
+ "ServicePrincipalPartitionMap": {
65
+ "aws": {
66
+ "EC2": "ec2.amazonaws.com",
67
+ "EKS": "eks.amazonaws.com",
68
+ "EKSFargatePods": "eks-fargate-pods.amazonaws.com"
69
+ },
70
+ "aws-cn": {
71
+ "EC2": "ec2.amazonaws.com.cn",
72
+ "EKS": "eks.amazonaws.com",
73
+ "EKSFargatePods": "eks-fargate-pods.amazonaws.com"
74
+ },
75
+ "aws-us-gov": {
76
+ "EC2": "ec2.amazonaws.com",
77
+ "EKS": "eks.amazonaws.com",
78
+ "EKSFargatePods": "eks-fargate-pods.amazonaws.com"
79
+ }
80
+ }
81
+ },
82
+ "Resources": {
83
+ "VPC": {
84
+ "Type": "AWS::EC2::VPC",
85
+ "Properties": {
86
+ "CidrBlock": {
87
+ "Ref": "VPCCidrBlock"
88
+ },
89
+ "EnableDnsSupport": true,
90
+ "EnableDnsHostnames": true,
91
+ "InstanceTenancy": "default",
92
+ "Tags": [
93
+ {
94
+ "Key": "Name",
95
+ "Value": {
96
+ "Fn::Sub": "${AWS::StackName}-vpc"
97
+ }
98
+ }
99
+ ]
100
+ }
101
+ },
102
+ "InternetGateway": {
103
+ "Type": "AWS::EC2::InternetGateway",
104
+ "Properties": {
105
+ "Tags": [
106
+ {
107
+ "Key": "Name",
108
+ "Value": {
109
+ "Fn::Sub": "${AWS::StackName}-ig"
110
+ }
111
+ }
112
+ ]
113
+ }
114
+ },
115
+ "AttachGateway": {
116
+ "Type": "AWS::EC2::VPCGatewayAttachment",
117
+ "Properties": {
118
+ "VpcId": {
119
+ "Ref": "VPC"
120
+ },
121
+ "InternetGatewayId": {
122
+ "Ref": "InternetGateway"
123
+ }
124
+ }
125
+ },
126
+ "PublicRouteTable": {
127
+ "Type": "AWS::EC2::RouteTable",
128
+ "Properties": {
129
+ "VpcId": {
130
+ "Ref": "VPC"
131
+ },
132
+ "Tags": [
133
+ {
134
+ "Key": "Name",
135
+ "Value": {
136
+ "Fn::Sub": "${AWS::StackName}-public-route-table"
137
+ }
138
+ }
139
+ ]
140
+ }
141
+ },
142
+ "RouteInternetGateway": {
143
+ "Type": "AWS::EC2::Route",
144
+ "Properties": {
145
+ "RouteTableId": {
146
+ "Ref": "PublicRouteTable"
147
+ },
148
+ "GatewayId": {
149
+ "Ref": "InternetGateway"
150
+ },
151
+ "DestinationCidrBlock": "0.0.0.0/0"
152
+ }
153
+ },
154
+ "PublicSubnet1": {
155
+ "Type": "AWS::EC2::Subnet",
156
+ "Properties": {
157
+ "VpcId": {
158
+ "Ref": "VPC"
159
+ },
160
+ "AvailabilityZone": {
161
+ "Fn::Select": [
162
+ 0,
163
+ {
164
+ "Fn::GetAZs": {
165
+ "Ref": "AWS::Region"
166
+ }
167
+ }
168
+ ]
169
+ },
170
+ "CidrBlock": {
171
+ "Ref": "PublicCidrBlock1"
172
+ },
173
+ "Tags": [
174
+ {
175
+ "Key": "Name",
176
+ "Value": {
177
+ "Fn::Sub": "${AWS::StackName}-public-subnet1"
178
+ }
179
+ },
180
+ {
181
+ "Key": "kubernetes.io/role/elb",
182
+ "Value": 1
183
+ }
184
+ ]
185
+ }
186
+ },
187
+ "PublicRouteTableAssociation1": {
188
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
189
+ "Properties": {
190
+ "RouteTableId": {
191
+ "Ref": "PublicRouteTable"
192
+ },
193
+ "SubnetId": {
194
+ "Ref": "PublicSubnet1"
195
+ }
196
+ }
197
+ },
198
+ "PublicSubnet2": {
199
+ "Type": "AWS::EC2::Subnet",
200
+ "Properties": {
201
+ "VpcId": {
202
+ "Ref": "VPC"
203
+ },
204
+ "AvailabilityZone": {
205
+ "Fn::Select": [
206
+ 1,
207
+ {
208
+ "Fn::GetAZs": {
209
+ "Ref": "AWS::Region"
210
+ }
211
+ }
212
+ ]
213
+ },
214
+ "CidrBlock": {
215
+ "Ref": "PublicCidrBlock2"
216
+ },
217
+ "Tags": [
218
+ {
219
+ "Key": "Name",
220
+ "Value": {
221
+ "Fn::Sub": "${AWS::StackName}-public-subnet2"
222
+ }
223
+ },
224
+ {
225
+ "Key": "kubernetes.io/role/elb",
226
+ "Value": 1
227
+ }
228
+ ]
229
+ }
230
+ },
231
+ "PublicRouteTableAssociation2": {
232
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
233
+ "Properties": {
234
+ "RouteTableId": {
235
+ "Ref": "PublicRouteTable"
236
+ },
237
+ "SubnetId": {
238
+ "Ref": "PublicSubnet2"
239
+ }
240
+ }
241
+ },
242
+ "PublicSubnet3": {
243
+ "Type": "AWS::EC2::Subnet",
244
+ "Properties": {
245
+ "VpcId": {
246
+ "Ref": "VPC"
247
+ },
248
+ "AvailabilityZone": {
249
+ "Fn::Select": [
250
+ 2,
251
+ {
252
+ "Fn::GetAZs": {
253
+ "Ref": "AWS::Region"
254
+ }
255
+ }
256
+ ]
257
+ },
258
+ "CidrBlock": {
259
+ "Ref": "PublicCidrBlock3"
260
+ },
261
+ "Tags": [
262
+ {
263
+ "Key": "Name",
264
+ "Value": {
265
+ "Fn::Sub": "${AWS::StackName}-public-subnet3"
266
+ }
267
+ },
268
+ {
269
+ "Key": "kubernetes.io/role/elb",
270
+ "Value": 1
271
+ }
272
+ ]
273
+ }
274
+ },
275
+ "PublicRouteTableAssociation3": {
276
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
277
+ "Properties": {
278
+ "RouteTableId": {
279
+ "Ref": "PublicRouteTable"
280
+ },
281
+ "SubnetId": {
282
+ "Ref": "PublicSubnet3"
283
+ }
284
+ }
285
+ },
286
+ "EIP1": {
287
+ "Type": "AWS::EC2::EIP",
288
+ "Properties": {
289
+ "Domain": "vpc"
290
+ }
291
+ },
292
+ "NATGateway1": {
293
+ "Type": "AWS::EC2::NatGateway",
294
+ "Properties": {
295
+ "AllocationId": {
296
+ "Fn::GetAtt": [
297
+ "EIP1",
298
+ "AllocationId"
299
+ ]
300
+ },
301
+ "SubnetId": {
302
+ "Ref": "PublicSubnet1"
303
+ },
304
+ "Tags": [
305
+ {
306
+ "Key": "Name",
307
+ "Value": {
308
+ "Fn::Sub": "${AWS::StackName}-nat-gw1"
309
+ }
310
+ }
311
+ ]
312
+ }
313
+ },
314
+ "EIP2": {
315
+ "Type": "AWS::EC2::EIP",
316
+ "Properties": {
317
+ "Domain": "vpc"
318
+ }
319
+ },
320
+ "NATGateway2": {
321
+ "Type": "AWS::EC2::NatGateway",
322
+ "Properties": {
323
+ "AllocationId": {
324
+ "Fn::GetAtt": [
325
+ "EIP2",
326
+ "AllocationId"
327
+ ]
328
+ },
329
+ "SubnetId": {
330
+ "Ref": "PublicSubnet2"
331
+ },
332
+ "Tags": [
333
+ {
334
+ "Key": "Name",
335
+ "Value": {
336
+ "Fn::Sub": "${AWS::StackName}-nat-gw2"
337
+ }
338
+ }
339
+ ]
340
+ }
341
+ },
342
+ "EIP3": {
343
+ "Type": "AWS::EC2::EIP",
344
+ "Properties": {
345
+ "Domain": "vpc"
346
+ }
347
+ },
348
+ "NATGateway3": {
349
+ "Type": "AWS::EC2::NatGateway",
350
+ "Properties": {
351
+ "AllocationId": {
352
+ "Fn::GetAtt": [
353
+ "EIP3",
354
+ "AllocationId"
355
+ ]
356
+ },
357
+ "SubnetId": {
358
+ "Ref": "PublicSubnet3"
359
+ },
360
+ "Tags": [
361
+ {
362
+ "Key": "Name",
363
+ "Value": {
364
+ "Fn::Sub": "${AWS::StackName}-nat-gw3"
365
+ }
366
+ }
367
+ ]
368
+ }
369
+ },
370
+ "PrivateSubnet1": {
371
+ "Type": "AWS::EC2::Subnet",
372
+ "Properties": {
373
+ "VpcId": {
374
+ "Ref": "VPC"
375
+ },
376
+ "AvailabilityZone": {
377
+ "Fn::Select": [
378
+ 0,
379
+ {
380
+ "Fn::GetAZs": {
381
+ "Ref": "AWS::Region"
382
+ }
383
+ }
384
+ ]
385
+ },
386
+ "CidrBlock": {
387
+ "Ref": "PrivateCidrBlock1"
388
+ },
389
+ "MapPublicIpOnLaunch": false,
390
+ "Tags": [
391
+ {
392
+ "Key": "Name",
393
+ "Value": {
394
+ "Fn::Sub": "${AWS::StackName}-private-subnet1"
395
+ }
396
+ }
397
+ ]
398
+ }
399
+ },
400
+ "PrivateRouteTable1": {
401
+ "Type": "AWS::EC2::RouteTable",
402
+ "Properties": {
403
+ "VpcId": {
404
+ "Ref": "VPC"
405
+ },
406
+ "Tags": [
407
+ {
408
+ "Key": "Name",
409
+ "Value": {
410
+ "Fn::Sub": "${AWS::StackName}-private-route-table1"
411
+ }
412
+ }
413
+ ]
414
+ }
415
+ },
416
+ "PrivateRouteTableAssociation1": {
417
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
418
+ "Properties": {
419
+ "RouteTableId": {
420
+ "Ref": "PrivateRouteTable1"
421
+ },
422
+ "SubnetId": {
423
+ "Ref": "PrivateSubnet1"
424
+ }
425
+ }
426
+ },
427
+ "PrivateRoute1": {
428
+ "Type": "AWS::EC2::Route",
429
+ "Properties": {
430
+ "RouteTableId": {
431
+ "Ref": "PrivateRouteTable1"
432
+ },
433
+ "NatGatewayId": {
434
+ "Ref": "NATGateway1"
435
+ },
436
+ "DestinationCidrBlock": "0.0.0.0/0"
437
+ }
438
+ },
439
+ "PrivateSubnet2": {
440
+ "Type": "AWS::EC2::Subnet",
441
+ "Properties": {
442
+ "VpcId": {
443
+ "Ref": "VPC"
444
+ },
445
+ "AvailabilityZone": {
446
+ "Fn::Select": [
447
+ 1,
448
+ {
449
+ "Fn::GetAZs": {
450
+ "Ref": "AWS::Region"
451
+ }
452
+ }
453
+ ]
454
+ },
455
+ "CidrBlock": {
456
+ "Ref": "PrivateCidrBlock2"
457
+ },
458
+ "MapPublicIpOnLaunch": false,
459
+ "Tags": [
460
+ {
461
+ "Key": "Name",
462
+ "Value": {
463
+ "Fn::Sub": "${AWS::StackName}-private-subnet2"
464
+ }
465
+ }
466
+ ]
467
+ }
468
+ },
469
+ "PrivateRouteTable2": {
470
+ "Type": "AWS::EC2::RouteTable",
471
+ "Properties": {
472
+ "VpcId": {
473
+ "Ref": "VPC"
474
+ },
475
+ "Tags": [
476
+ {
477
+ "Key": "Name",
478
+ "Value": {
479
+ "Fn::Sub": "${AWS::StackName}-private-route-table2"
480
+ }
481
+ }
482
+ ]
483
+ }
484
+ },
485
+ "PrivateRouteTableAssociation2": {
486
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
487
+ "Properties": {
488
+ "RouteTableId": {
489
+ "Ref": "PrivateRouteTable2"
490
+ },
491
+ "SubnetId": {
492
+ "Ref": "PrivateSubnet2"
493
+ }
494
+ }
495
+ },
496
+ "PrivateRoute2": {
497
+ "Type": "AWS::EC2::Route",
498
+ "Properties": {
499
+ "RouteTableId": {
500
+ "Ref": "PrivateRouteTable2"
501
+ },
502
+ "NatGatewayId": {
503
+ "Ref": "NATGateway2"
504
+ },
505
+ "DestinationCidrBlock": "0.0.0.0/0"
506
+ }
507
+ },
508
+ "PrivateSubnet3": {
509
+ "Type": "AWS::EC2::Subnet",
510
+ "Properties": {
511
+ "VpcId": {
512
+ "Ref": "VPC"
513
+ },
514
+ "AvailabilityZone": {
515
+ "Fn::Select": [
516
+ 2,
517
+ {
518
+ "Fn::GetAZs": {
519
+ "Ref": "AWS::Region"
520
+ }
521
+ }
522
+ ]
523
+ },
524
+ "CidrBlock": {
525
+ "Ref": "PrivateCidrBlock3"
526
+ },
527
+ "MapPublicIpOnLaunch": false,
528
+ "Tags": [
529
+ {
530
+ "Key": "Name",
531
+ "Value": {
532
+ "Fn::Sub": "${AWS::StackName}-private-subnet3"
533
+ }
534
+ }
535
+ ]
536
+ }
537
+ },
538
+ "PrivateRouteTable3": {
539
+ "Type": "AWS::EC2::RouteTable",
540
+ "Properties": {
541
+ "VpcId": {
542
+ "Ref": "VPC"
543
+ },
544
+ "Tags": [
545
+ {
546
+ "Key": "Name",
547
+ "Value": {
548
+ "Fn::Sub": "${AWS::StackName}-private-route-table3"
549
+ }
550
+ }
551
+ ]
552
+ }
553
+ },
554
+ "PrivateRouteTableAssociation3": {
555
+ "Type": "AWS::EC2::SubnetRouteTableAssociation",
556
+ "Properties": {
557
+ "RouteTableId": {
558
+ "Ref": "PrivateRouteTable3"
559
+ },
560
+ "SubnetId": {
561
+ "Ref": "PrivateSubnet3"
562
+ }
563
+ }
564
+ },
565
+ "PrivateRoute3": {
566
+ "Type": "AWS::EC2::Route",
567
+ "Properties": {
568
+ "RouteTableId": {
569
+ "Ref": "PrivateRouteTable3"
570
+ },
571
+ "NatGatewayId": {
572
+ "Ref": "NATGateway3"
573
+ },
574
+ "DestinationCidrBlock": "0.0.0.0/0"
575
+ }
576
+ },
577
+ "ControlPlane": {
578
+ "Type": "AWS::EKS::Cluster",
579
+ "Properties": {
580
+ "Name": {
581
+ "Fn::Sub": "${AWS::StackName}-cluster"
582
+ },
583
+ "ResourcesVpcConfig": {
584
+ "SecurityGroupIds": [
585
+ {
586
+ "Ref": "ControlPlaneSecurityGroup"
587
+ }
588
+ ],
589
+ "SubnetIds": [
590
+ {
591
+ "Ref": "PublicSubnet1"
592
+ },
593
+ {
594
+ "Ref": "PublicSubnet2"
595
+ },
596
+ {
597
+ "Ref": "PublicSubnet3"
598
+ },
599
+ {
600
+ "Ref": "PrivateSubnet1"
601
+ },
602
+ {
603
+ "Ref": "PrivateSubnet2"
604
+ },
605
+ {
606
+ "Ref": "PrivateSubnet3"
607
+ }
608
+ ]
609
+ },
610
+ "RoleArn": {
611
+ "Fn::GetAtt": [
612
+ "EKSClusterRole",
613
+ "Arn"
614
+ ]
615
+ },
616
+ "Version": {
617
+ "Ref": "EKSClusterVersion"
618
+ }
619
+ }
620
+ },
621
+ "EKSClusterRole": {
622
+ "Type": "AWS::IAM::Role",
623
+ "Properties": {
624
+ "AssumeRolePolicyDocument": {
625
+ "Statement": [
626
+ {
627
+ "Action": [
628
+ "sts:AssumeRole"
629
+ ],
630
+ "Effect": "Allow",
631
+ "Principal": {
632
+ "Service": {
633
+ "Fn::FindInMap": [
634
+ "ServicePrincipalPartitionMap",
635
+ {
636
+ "Ref": "AWS::Partition"
637
+ },
638
+ "EKS"
639
+ ]
640
+ }
641
+ }
642
+ }
643
+ ],
644
+ "Version": "2012-10-17"
645
+ },
646
+ "ManagedPolicyArns": [
647
+ {
648
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonEKSClusterPolicy"
649
+ },
650
+ {
651
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonEKSVPCResourceController"
652
+ }
653
+ ]
654
+ }
655
+ },
656
+ "ControlPlaneSecurityGroup": {
657
+ "Type": "AWS::EC2::SecurityGroup",
658
+ "Properties": {
659
+ "GroupDescription": "Communication between the control plane and worker nodegroups",
660
+ "VpcId": {
661
+ "Ref": "VPC"
662
+ },
663
+ "GroupName": {
664
+ "Fn::Sub": "${AWS::StackName}-eks-control-plane-sg"
665
+ }
666
+ }
667
+ },
668
+ "ControlPlaneSecurityGroupIngress": {
669
+ "Type": "AWS::EC2::SecurityGroupIngress",
670
+ "Properties": {
671
+ "GroupId": {
672
+ "Ref": "ControlPlaneSecurityGroup"
673
+ },
674
+ "IpProtocol": "-1",
675
+ "SourceSecurityGroupId": {
676
+ "Fn::GetAtt": [
677
+ "ControlPlaneSecurityGroup",
678
+ "GroupId"
679
+ ]
680
+ },
681
+ "SourceSecurityGroupOwnerId": {
682
+ "Ref": "AWS::AccountId"
683
+ }
684
+ }
685
+ },
686
+ "LaunchTemplate": {
687
+ "Type": "AWS::EC2::LaunchTemplate",
688
+ "Properties": {
689
+ "LaunchTemplateData": {
690
+ "BlockDeviceMappings": [
691
+ {
692
+ "DeviceName": "/dev/xvda",
693
+ "Ebs": {
694
+ "Iops": 3000,
695
+ "Throughput": 125,
696
+ "VolumeSize": 80,
697
+ "VolumeType": "gp3"
698
+ }
699
+ }
700
+ ],
701
+ "MetadataOptions": {
702
+ "HttpPutResponseHopLimit": 2,
703
+ "HttpTokens": "optional"
704
+ },
705
+ "SecurityGroupIds": [
706
+ {
707
+ "Ref": "ControlPlaneSecurityGroup"
708
+ }
709
+ ],
710
+ "TagSpecifications": [
711
+ {
712
+ "ResourceType": "instance",
713
+ "Tags": [
714
+ {
715
+ "Key": "Name",
716
+ "Value": {
717
+ "Fn::Sub": "ekshandson-ng-${AWS::StackName}-Node"
718
+ }
719
+ },
720
+ {
721
+ "Key": "alpha.eksctl.io/nodegroup-name",
722
+ "Value": {
723
+ "Fn::Sub": "ng-${AWS::StackName}"
724
+ }
725
+ },
726
+ {
727
+ "Key": "alpha.eksctl.io/nodegroup-type",
728
+ "Value": "managed"
729
+ }
730
+ ]
731
+ },
732
+ {
733
+ "ResourceType": "volume",
734
+ "Tags": [
735
+ {
736
+ "Key": "Name",
737
+ "Value": {
738
+ "Fn::Sub": "ekshandson-ng-${AWS::StackName}-Node"
739
+ }
740
+ },
741
+ {
742
+ "Key": "alpha.eksctl.io/nodegroup-name",
743
+ "Value": {
744
+ "Fn::Sub": "ng-${AWS::StackName}"
745
+ }
746
+ },
747
+ {
748
+ "Key": "alpha.eksctl.io/nodegroup-type",
749
+ "Value": "managed"
750
+ }
751
+ ]
752
+ },
753
+ {
754
+ "ResourceType": "network-interface",
755
+ "Tags": [
756
+ {
757
+ "Key": "Name",
758
+ "Value": {
759
+ "Fn::Sub": "ekshandson-ng-${AWS::StackName}-Node"
760
+ }
761
+ },
762
+ {
763
+ "Key": "alpha.eksctl.io/nodegroup-name",
764
+ "Value": {
765
+ "Fn::Sub": "ng-${AWS::StackName}"
766
+ }
767
+ },
768
+ {
769
+ "Key": "alpha.eksctl.io/nodegroup-type",
770
+ "Value": "managed"
771
+ }
772
+ ]
773
+ }
774
+ ]
775
+ },
776
+ "LaunchTemplateName": {
777
+ "Fn::Sub": "${AWS::StackName}-LaunchTemplate"
778
+ }
779
+ }
780
+ },
781
+ "ManagedNodeGroup": {
782
+ "Type": "AWS::EKS::Nodegroup",
783
+ "Properties": {
784
+ "AmiType": "AL2_x86_64",
785
+ "ClusterName": {
786
+ "Ref": "ControlPlane"
787
+ },
788
+ "InstanceTypes": [
789
+ {
790
+ "Ref": "NodeGroupInstanceTypes"
791
+ }
792
+ ],
793
+ "Labels": {
794
+ "alpha.eksctl.io/cluster-name": {
795
+ "Ref": "ControlPlane"
796
+ },
797
+ "alpha.eksctl.io/nodegroup-name": {
798
+ "Fn::Sub": "ng-${AWS::StackName}"
799
+ }
800
+ },
801
+ "LaunchTemplate": {
802
+ "Id": {
803
+ "Ref": "LaunchTemplate"
804
+ }
805
+ },
806
+ "NodeRole": {
807
+ "Fn::GetAtt": [
808
+ "NodeInstanceRole",
809
+ "Arn"
810
+ ]
811
+ },
812
+ "NodegroupName": {
813
+ "Fn::Sub": "ng-${AWS::StackName}"
814
+ },
815
+ "ScalingConfig": {
816
+ "DesiredSize": 2,
817
+ "MaxSize": 2,
818
+ "MinSize": 2
819
+ },
820
+ "Subnets": [
821
+ {
822
+ "Ref": "PrivateSubnet1"
823
+ },
824
+ {
825
+ "Ref": "PrivateSubnet2"
826
+ },
827
+ {
828
+ "Ref": "PrivateSubnet3"
829
+ }
830
+ ],
831
+ "Tags": {
832
+ "alpha.eksctl.io/nodegroup-name": {
833
+ "Fn::Sub": "ng-${AWS::StackName}"
834
+ },
835
+ "alpha.eksctl.io/nodegroup-type": "managed"
836
+ }
837
+ }
838
+ },
839
+ "NodeInstanceRole": {
840
+ "Type": "AWS::IAM::Role",
841
+ "Properties": {
842
+ "RoleName": {
843
+ "Fn::Sub": "${AWS::StackName}-eks-node-role"
844
+ },
845
+ "AssumeRolePolicyDocument": {
846
+ "Statement": [
847
+ {
848
+ "Action": [
849
+ "sts:AssumeRole"
850
+ ],
851
+ "Effect": "Allow",
852
+ "Principal": {
853
+ "Service": {
854
+ "Fn::FindInMap": [
855
+ "ServicePrincipalPartitionMap",
856
+ {
857
+ "Ref": "AWS::Partition"
858
+ },
859
+ "EC2"
860
+ ]
861
+ }
862
+ }
863
+ }
864
+ ],
865
+ "Version": "2012-10-17"
866
+ },
867
+ "ManagedPolicyArns": [
868
+ {
869
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
870
+ },
871
+ {
872
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonEKSWorkerNodePolicy"
873
+ },
874
+ {
875
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonEKS_CNI_Policy"
876
+ },
877
+ {
878
+ "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/AmazonSSMManagedInstanceCore"
879
+ }
880
+ ],
881
+ "Path": "/"
882
+ }
883
+ }
884
+ }
885
+ }
human_reference_dataset/aws-cloudformation-templates/EKS/template.yaml ADDED
@@ -0,0 +1,461 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+
3
+ Description: AWS CloudFormation Sample Template EKS Cluster on EC2
4
+
5
+ Metadata:
6
+ AWS::CloudFormation::Interface:
7
+ ParameterGroups:
8
+ - Label:
9
+ default: Parameters
10
+ Parameters:
11
+ - VPCCidrBlock
12
+ - PublicCidrBlock1
13
+ - PublicCidrBlock2
14
+ - PublicCidrBlock3
15
+ - PrivateCidrBlock1
16
+ - PrivateCidrBlock2
17
+ - PrivateCidrBlock3
18
+ - EKSClusterVersion
19
+ - NodeGroupInstanceTypes
20
+
21
+ Parameters:
22
+ VPCCidrBlock:
23
+ Type: String
24
+ Default: 10.0.0.0/16
25
+
26
+ PublicCidrBlock1:
27
+ Type: String
28
+ Default: 10.0.1.0/24
29
+
30
+ PublicCidrBlock2:
31
+ Type: String
32
+ Default: 10.0.2.0/24
33
+
34
+ PublicCidrBlock3:
35
+ Type: String
36
+ Default: 10.0.3.0/24
37
+
38
+ PrivateCidrBlock1:
39
+ Type: String
40
+ Default: 10.0.4.0/24
41
+
42
+ PrivateCidrBlock2:
43
+ Type: String
44
+ Default: 10.0.5.0/24
45
+
46
+ PrivateCidrBlock3:
47
+ Type: String
48
+ Default: 10.0.6.0/24
49
+
50
+ EKSClusterVersion:
51
+ Type: String
52
+
53
+ NodeGroupInstanceTypes:
54
+ Type: String
55
+ Default: t3.medium
56
+
57
+ Mappings:
58
+ ServicePrincipalPartitionMap:
59
+ aws:
60
+ EC2: ec2.amazonaws.com
61
+ EKS: eks.amazonaws.com
62
+ EKSFargatePods: eks-fargate-pods.amazonaws.com
63
+ aws-cn:
64
+ EC2: ec2.amazonaws.com.cn
65
+ EKS: eks.amazonaws.com
66
+ EKSFargatePods: eks-fargate-pods.amazonaws.com
67
+ aws-us-gov:
68
+ EC2: ec2.amazonaws.com
69
+ EKS: eks.amazonaws.com
70
+ EKSFargatePods: eks-fargate-pods.amazonaws.com
71
+
72
+ Resources:
73
+ VPC:
74
+ Type: AWS::EC2::VPC
75
+ Properties:
76
+ CidrBlock: !Ref VPCCidrBlock
77
+ EnableDnsSupport: true
78
+ EnableDnsHostnames: true
79
+ InstanceTenancy: default
80
+ Tags:
81
+ - Key: Name
82
+ Value: !Sub ${AWS::StackName}-vpc
83
+
84
+ InternetGateway:
85
+ Type: AWS::EC2::InternetGateway
86
+ Properties:
87
+ Tags:
88
+ - Key: Name
89
+ Value: !Sub ${AWS::StackName}-ig
90
+
91
+ AttachGateway:
92
+ Type: AWS::EC2::VPCGatewayAttachment
93
+ Properties:
94
+ VpcId: !Ref VPC
95
+ InternetGatewayId: !Ref InternetGateway
96
+
97
+ PublicRouteTable:
98
+ Type: AWS::EC2::RouteTable
99
+ Properties:
100
+ VpcId: !Ref VPC
101
+ Tags:
102
+ - Key: Name
103
+ Value: !Sub ${AWS::StackName}-public-route-table
104
+
105
+ RouteInternetGateway:
106
+ Type: AWS::EC2::Route
107
+ Properties:
108
+ RouteTableId: !Ref PublicRouteTable
109
+ GatewayId: !Ref InternetGateway
110
+ DestinationCidrBlock: 0.0.0.0/0
111
+
112
+ PublicSubnet1:
113
+ Type: AWS::EC2::Subnet
114
+ Properties:
115
+ VpcId: !Ref VPC
116
+ AvailabilityZone: !Select
117
+ - 0
118
+ - !GetAZs
119
+ Ref: AWS::Region
120
+ CidrBlock: !Ref PublicCidrBlock1
121
+ Tags:
122
+ - Key: Name
123
+ Value: !Sub ${AWS::StackName}-public-subnet1
124
+ - Key: kubernetes.io/role/elb
125
+ Value: 1
126
+
127
+ PublicRouteTableAssociation1:
128
+ Type: AWS::EC2::SubnetRouteTableAssociation
129
+ Properties:
130
+ RouteTableId: !Ref PublicRouteTable
131
+ SubnetId: !Ref PublicSubnet1
132
+
133
+ PublicSubnet2:
134
+ Type: AWS::EC2::Subnet
135
+ Properties:
136
+ VpcId: !Ref VPC
137
+ AvailabilityZone: !Select
138
+ - 1
139
+ - !GetAZs
140
+ Ref: AWS::Region
141
+ CidrBlock: !Ref PublicCidrBlock2
142
+ Tags:
143
+ - Key: Name
144
+ Value: !Sub ${AWS::StackName}-public-subnet2
145
+ - Key: kubernetes.io/role/elb
146
+ Value: 1
147
+
148
+ PublicRouteTableAssociation2:
149
+ Type: AWS::EC2::SubnetRouteTableAssociation
150
+ Properties:
151
+ RouteTableId: !Ref PublicRouteTable
152
+ SubnetId: !Ref PublicSubnet2
153
+
154
+ PublicSubnet3:
155
+ Type: AWS::EC2::Subnet
156
+ Properties:
157
+ VpcId: !Ref VPC
158
+ AvailabilityZone: !Select
159
+ - 2
160
+ - !GetAZs
161
+ Ref: AWS::Region
162
+ CidrBlock: !Ref PublicCidrBlock3
163
+ Tags:
164
+ - Key: Name
165
+ Value: !Sub ${AWS::StackName}-public-subnet3
166
+ - Key: kubernetes.io/role/elb
167
+ Value: 1
168
+
169
+ PublicRouteTableAssociation3:
170
+ Type: AWS::EC2::SubnetRouteTableAssociation
171
+ Properties:
172
+ RouteTableId: !Ref PublicRouteTable
173
+ SubnetId: !Ref PublicSubnet3
174
+
175
+ EIP1:
176
+ Type: AWS::EC2::EIP
177
+ Properties:
178
+ Domain: vpc
179
+
180
+ NATGateway1:
181
+ Type: AWS::EC2::NatGateway
182
+ Properties:
183
+ AllocationId: !GetAtt EIP1.AllocationId
184
+ SubnetId: !Ref PublicSubnet1
185
+ Tags:
186
+ - Key: Name
187
+ Value: !Sub ${AWS::StackName}-nat-gw1
188
+
189
+ EIP2:
190
+ Type: AWS::EC2::EIP
191
+ Properties:
192
+ Domain: vpc
193
+
194
+ NATGateway2:
195
+ Type: AWS::EC2::NatGateway
196
+ Properties:
197
+ AllocationId: !GetAtt EIP2.AllocationId
198
+ SubnetId: !Ref PublicSubnet2
199
+ Tags:
200
+ - Key: Name
201
+ Value: !Sub ${AWS::StackName}-nat-gw2
202
+
203
+ EIP3:
204
+ Type: AWS::EC2::EIP
205
+ Properties:
206
+ Domain: vpc
207
+
208
+ NATGateway3:
209
+ Type: AWS::EC2::NatGateway
210
+ Properties:
211
+ AllocationId: !GetAtt EIP3.AllocationId
212
+ SubnetId: !Ref PublicSubnet3
213
+ Tags:
214
+ - Key: Name
215
+ Value: !Sub ${AWS::StackName}-nat-gw3
216
+
217
+ PrivateSubnet1:
218
+ Type: AWS::EC2::Subnet
219
+ Properties:
220
+ VpcId: !Ref VPC
221
+ AvailabilityZone: !Select
222
+ - 0
223
+ - !GetAZs
224
+ Ref: AWS::Region
225
+ CidrBlock: !Ref PrivateCidrBlock1
226
+ MapPublicIpOnLaunch: false
227
+ Tags:
228
+ - Key: Name
229
+ Value: !Sub ${AWS::StackName}-private-subnet1
230
+
231
+ PrivateRouteTable1:
232
+ Type: AWS::EC2::RouteTable
233
+ Properties:
234
+ VpcId: !Ref VPC
235
+ Tags:
236
+ - Key: Name
237
+ Value: !Sub ${AWS::StackName}-private-route-table1
238
+
239
+ PrivateRouteTableAssociation1:
240
+ Type: AWS::EC2::SubnetRouteTableAssociation
241
+ Properties:
242
+ RouteTableId: !Ref PrivateRouteTable1
243
+ SubnetId: !Ref PrivateSubnet1
244
+
245
+ PrivateRoute1:
246
+ Type: AWS::EC2::Route
247
+ Properties:
248
+ RouteTableId: !Ref PrivateRouteTable1
249
+ NatGatewayId: !Ref NATGateway1
250
+ DestinationCidrBlock: 0.0.0.0/0
251
+
252
+ PrivateSubnet2:
253
+ Type: AWS::EC2::Subnet
254
+ Properties:
255
+ VpcId: !Ref VPC
256
+ AvailabilityZone: !Select
257
+ - 1
258
+ - !GetAZs
259
+ Ref: AWS::Region
260
+ CidrBlock: !Ref PrivateCidrBlock2
261
+ MapPublicIpOnLaunch: false
262
+ Tags:
263
+ - Key: Name
264
+ Value: !Sub ${AWS::StackName}-private-subnet2
265
+
266
+ PrivateRouteTable2:
267
+ Type: AWS::EC2::RouteTable
268
+ Properties:
269
+ VpcId: !Ref VPC
270
+ Tags:
271
+ - Key: Name
272
+ Value: !Sub ${AWS::StackName}-private-route-table2
273
+
274
+ PrivateRouteTableAssociation2:
275
+ Type: AWS::EC2::SubnetRouteTableAssociation
276
+ Properties:
277
+ RouteTableId: !Ref PrivateRouteTable2
278
+ SubnetId: !Ref PrivateSubnet2
279
+
280
+ PrivateRoute2:
281
+ Type: AWS::EC2::Route
282
+ Properties:
283
+ RouteTableId: !Ref PrivateRouteTable2
284
+ NatGatewayId: !Ref NATGateway2
285
+ DestinationCidrBlock: 0.0.0.0/0
286
+
287
+ PrivateSubnet3:
288
+ Type: AWS::EC2::Subnet
289
+ Properties:
290
+ VpcId: !Ref VPC
291
+ AvailabilityZone: !Select
292
+ - 2
293
+ - !GetAZs
294
+ Ref: AWS::Region
295
+ CidrBlock: !Ref PrivateCidrBlock3
296
+ MapPublicIpOnLaunch: false
297
+ Tags:
298
+ - Key: Name
299
+ Value: !Sub ${AWS::StackName}-private-subnet3
300
+
301
+ PrivateRouteTable3:
302
+ Type: AWS::EC2::RouteTable
303
+ Properties:
304
+ VpcId: !Ref VPC
305
+ Tags:
306
+ - Key: Name
307
+ Value: !Sub ${AWS::StackName}-private-route-table3
308
+
309
+ PrivateRouteTableAssociation3:
310
+ Type: AWS::EC2::SubnetRouteTableAssociation
311
+ Properties:
312
+ RouteTableId: !Ref PrivateRouteTable3
313
+ SubnetId: !Ref PrivateSubnet3
314
+
315
+ PrivateRoute3:
316
+ Type: AWS::EC2::Route
317
+ Properties:
318
+ RouteTableId: !Ref PrivateRouteTable3
319
+ NatGatewayId: !Ref NATGateway3
320
+ DestinationCidrBlock: 0.0.0.0/0
321
+
322
+ ControlPlane:
323
+ Type: AWS::EKS::Cluster
324
+ Properties:
325
+ Name: !Sub ${AWS::StackName}-cluster
326
+ ResourcesVpcConfig:
327
+ SecurityGroupIds:
328
+ - !Ref ControlPlaneSecurityGroup
329
+ SubnetIds:
330
+ - !Ref PublicSubnet1
331
+ - !Ref PublicSubnet2
332
+ - !Ref PublicSubnet3
333
+ - !Ref PrivateSubnet1
334
+ - !Ref PrivateSubnet2
335
+ - !Ref PrivateSubnet3
336
+ RoleArn: !GetAtt EKSClusterRole.Arn
337
+ Version: !Ref EKSClusterVersion
338
+
339
+ EKSClusterRole:
340
+ Type: AWS::IAM::Role
341
+ Properties:
342
+ AssumeRolePolicyDocument:
343
+ Statement:
344
+ - Action:
345
+ - sts:AssumeRole
346
+ Effect: Allow
347
+ Principal:
348
+ Service: !FindInMap
349
+ - ServicePrincipalPartitionMap
350
+ - !Ref AWS::Partition
351
+ - EKS
352
+ Version: "2012-10-17"
353
+ ManagedPolicyArns:
354
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonEKSClusterPolicy
355
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonEKSVPCResourceController
356
+
357
+ ControlPlaneSecurityGroup:
358
+ Type: AWS::EC2::SecurityGroup
359
+ Properties:
360
+ GroupDescription: Communication between the control plane and worker nodegroups
361
+ VpcId: !Ref VPC
362
+ GroupName: !Sub ${AWS::StackName}-eks-control-plane-sg
363
+
364
+ ControlPlaneSecurityGroupIngress:
365
+ Type: AWS::EC2::SecurityGroupIngress
366
+ Properties:
367
+ GroupId: !Ref ControlPlaneSecurityGroup
368
+ IpProtocol: "-1"
369
+ SourceSecurityGroupId: !GetAtt ControlPlaneSecurityGroup.GroupId
370
+ SourceSecurityGroupOwnerId: !Ref AWS::AccountId
371
+
372
+ LaunchTemplate:
373
+ Type: AWS::EC2::LaunchTemplate
374
+ Properties:
375
+ LaunchTemplateData:
376
+ BlockDeviceMappings:
377
+ - DeviceName: /dev/xvda
378
+ Ebs:
379
+ Iops: 3000
380
+ Throughput: 125
381
+ VolumeSize: 80
382
+ VolumeType: gp3
383
+ MetadataOptions:
384
+ HttpPutResponseHopLimit: 2
385
+ HttpTokens: optional
386
+ SecurityGroupIds:
387
+ - !Ref ControlPlaneSecurityGroup
388
+ TagSpecifications:
389
+ - ResourceType: instance
390
+ Tags:
391
+ - Key: Name
392
+ Value: !Sub ekshandson-ng-${AWS::StackName}-Node
393
+ - Key: alpha.eksctl.io/nodegroup-name
394
+ Value: !Sub ng-${AWS::StackName}
395
+ - Key: alpha.eksctl.io/nodegroup-type
396
+ Value: managed
397
+ - ResourceType: volume
398
+ Tags:
399
+ - Key: Name
400
+ Value: !Sub ekshandson-ng-${AWS::StackName}-Node
401
+ - Key: alpha.eksctl.io/nodegroup-name
402
+ Value: !Sub ng-${AWS::StackName}
403
+ - Key: alpha.eksctl.io/nodegroup-type
404
+ Value: managed
405
+ - ResourceType: network-interface
406
+ Tags:
407
+ - Key: Name
408
+ Value: !Sub ekshandson-ng-${AWS::StackName}-Node
409
+ - Key: alpha.eksctl.io/nodegroup-name
410
+ Value: !Sub ng-${AWS::StackName}
411
+ - Key: alpha.eksctl.io/nodegroup-type
412
+ Value: managed
413
+ LaunchTemplateName: !Sub ${AWS::StackName}-LaunchTemplate
414
+
415
+ ManagedNodeGroup:
416
+ Type: AWS::EKS::Nodegroup
417
+ Properties:
418
+ AmiType: AL2_x86_64
419
+ ClusterName: !Ref ControlPlane
420
+ InstanceTypes:
421
+ - !Ref NodeGroupInstanceTypes
422
+ Labels:
423
+ alpha.eksctl.io/cluster-name: !Ref ControlPlane
424
+ alpha.eksctl.io/nodegroup-name: !Sub ng-${AWS::StackName}
425
+ LaunchTemplate:
426
+ Id: !Ref LaunchTemplate
427
+ NodeRole: !GetAtt NodeInstanceRole.Arn
428
+ NodegroupName: !Sub ng-${AWS::StackName}
429
+ ScalingConfig:
430
+ DesiredSize: 2
431
+ MaxSize: 2
432
+ MinSize: 2
433
+ Subnets:
434
+ - !Ref PrivateSubnet1
435
+ - !Ref PrivateSubnet2
436
+ - !Ref PrivateSubnet3
437
+ Tags:
438
+ alpha.eksctl.io/nodegroup-name: !Sub ng-${AWS::StackName}
439
+ alpha.eksctl.io/nodegroup-type: managed
440
+
441
+ NodeInstanceRole:
442
+ Type: AWS::IAM::Role
443
+ Properties:
444
+ RoleName: !Sub ${AWS::StackName}-eks-node-role
445
+ AssumeRolePolicyDocument:
446
+ Statement:
447
+ - Action:
448
+ - sts:AssumeRole
449
+ Effect: Allow
450
+ Principal:
451
+ Service: !FindInMap
452
+ - ServicePrincipalPartitionMap
453
+ - !Ref AWS::Partition
454
+ - EC2
455
+ Version: "2012-10-17"
456
+ ManagedPolicyArns:
457
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly
458
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonEKSWorkerNodePolicy
459
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonEKS_CNI_Policy
460
+ - !Sub arn:${AWS::Partition}:iam::aws:policy/AmazonSSMManagedInstanceCore
461
+ Path: /