-
Notifications
You must be signed in to change notification settings - Fork 2
/
master.yml
132 lines (112 loc) · 3.34 KB
/
master.yml
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
---
AWSTemplateFormatVersion: 2010-09-09
Description: >-
Casper node
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
-
Label:
default: Instance Configuration
Parameters:
- InstanceType
- EbsVolumeSize
- KeyName
- IpWhitelist
-
Label:
default: Node Configuration
Parameters:
- CustomInitScript
-
Label:
default: Metadata
Parameters:
- OwnerName
- ProjectName
- Environment
ParameterLabels:
KeyName:
default: KeyName (Optional)
IpWhitelist:
default: IpWhitelist (Required if SSH access is enabled)
CustomInitScript:
default: CustomInitScript (Optional)
Parameters:
InstanceType:
Type: String
Default: r5.xlarge
Description: Instance type for the nodes
EbsVolumeSize:
Type: Number
Default: 2000
Description: Size of the EBS volume of the instances in GB
KeyName:
Type: String
Default: ''
Description: Name of an existing EC2 KeyPair to enable SSH access to the instances. Leave blank to disable SSH access.
IpWhitelist:
Type: String
Default: ''
Description: IP to allow SSH access to the node. (e.g. 1.2.3.4/32)
# ############## Service #############
CustomInitScript:
Type: String
Default: |
#!/bin/bash -x \n
echo Custom Init Script
Description: A custom script to execute before the node initialization. (Represent new lines with \n character)
# ############### Tags ###############
OwnerName:
Type: String
Description: An arbitrary tag name for the owner of these resources
ProjectName:
Type: String
Description: The name of the stack to which these resources belong
Environment:
Type: String
Default: main
Description: Environment name to append to resources names and tags
AllowedPattern: ^[a-z0-9]*$
MaxLength: 10
ConstraintDescription: Must be no longer than 10 alpha-numeric characters and must be lowercase.
Conditions:
Never: !Equals [ true, false ]
Resources:
NullResource:
Type: Custom::NullResource
Condition: Never
Vpc:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: ./templates/network-2azs.yml
Parameters:
Identifier: !Sub casper-${Environment}
VpcCidr: 172.16.0.0/16
PublicSubnetsCidr: !Join [ ',', [ 172.16.0.0/20, 172.16.16.0/20 ] ]
PrivateSubnetsCidr: !Join [ ',', [ 172.16.32.0/20, 172.16.48.0/20 ] ]
SetNatGateway: false
NatGatewayHA: false
OwnerName: !Ref OwnerName
ProjectName: !Ref ProjectName
Environment: !Ref Environment
CasperNode:
Type: AWS::CloudFormation::Stack
Properties:
TemplateURL: ./templates/casper-node.yml
Parameters:
Identifier: !Sub casper-${Environment}
VpcId: !GetAtt Vpc.Outputs.VpcId
SubnetIds: !GetAtt Vpc.Outputs.PublicSubnetIds
InstanceType: !Ref InstanceType
EbsVolumeSize: !Ref EbsVolumeSize
KeyName: !Ref KeyName
IpWhitelist: !Ref IpWhitelist
CustomInitScript: !Ref CustomInitScript
OwnerName: !Ref OwnerName
ProjectName: !Ref ProjectName
Environment: !Ref Environment
Outputs:
DashboardUrl:
Description: CloudWatch dashboard URL
Value: !GetAtt CasperNode.Outputs.DashboardUrl