-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.environment.yaml
242 lines (222 loc) · 6.24 KB
/
sample.environment.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
---
AWSTemplateFormatVersion: 2010-09-09
Description: "Performance Test Environment"
Parameters:
RegionName:
Type: String
Default: us-west-2
KeyName:
Type: String
ServerInstanceType:
Type: String
Default: m7i.2xlarge
ClientInstanceType:
Type: String
Default: m7i.4xlarge
ViewerInstanceType:
Type: String
Default: m7i.xlarge
AMI:
Type: String
# Default: ami-0eb199b995e2bc4e3 # Ubuntu_20
Default: ami-0895022f3dac85884 # Amazon Linux 2023
Resources:
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: 10.0.0.0/16
EnableDnsSupport: true
EnableDnsHostnames: true
InstanceTenancy: default
InternetGateway:
Type: AWS::EC2::InternetGateway
GatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
VpcId: !Ref VPC
InternetGatewayId: !Ref InternetGateway
PublicSubnetA:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.1.0/24
AvailabilityZone: !Join
- ''
- - !Ref RegionName
- a
MapPublicIpOnLaunch: true
VpcId: !Ref VPC
PublicSubnetB:
Type: AWS::EC2::Subnet
Properties:
CidrBlock: 10.0.2.0/24
AvailabilityZone: !Join
- ''
- - !Ref RegionName
- b
MapPublicIpOnLaunch: true
VpcId: !Ref VPC
# PublicSubnetC:
# Type: AWS::EC2::Subnet
# Properties:
# CidrBlock: 10.0.3.0/24
# AvailabilityZone: !Join
# - ''
# - - !Ref RegionName
# - c
# MapPublicIpOnLaunch: true
# VpcId: !Ref VPC
MainRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref VPC
NonLocalRoute:
Type: AWS::EC2::Route
Properties:
DestinationCidrBlock: 0.0.0.0/0
RouteTableId: !Ref MainRouteTable
GatewayId: !Ref InternetGateway
DependsOn: InternetGateway
PublicSubnetRouteTableAssociationA:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref MainRouteTable
SubnetId: !Ref PublicSubnetA
PublicSubnetRouteTableAssociationB:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref MainRouteTable
SubnetId: !Ref PublicSubnetB
# PublicSubnetRouteTableAssociationC:
# Type: AWS::EC2::SubnetRouteTableAssociation
# Properties:
# RouteTableId: !Ref MainRouteTable
# SubnetId: !Ref PublicSubnetC
ViewerSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: ManagerSecurityGroup
GroupDescription: Manager Ingress
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: 8080
ToPort: 8080
IpProtocol: tcp
SSHSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: SSHSecurityGroup
GroupDescription: SSH Ingress
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: 22
ToPort: 22
IpProtocol: tcp
LocalSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: LocalSecurityGroup
GroupDescription: Ingress from within the VPC
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 10.0.0.0/16
FromPort: -1
ToPort: -1
IpProtocol: -1
RedisSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: RedisSecurityGroup
GroupDescription: Ingress for Redis
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: 8443
ToPort: 8443
IpProtocol: tcp
- CidrIp: 0.0.0.0/0
FromPort: 9443
ToPort: 9443
IpProtocol: tcp
ServerInstance1:
Type: AWS::EC2::Instance
Properties:
SubnetId: !Ref PublicSubnetA
SecurityGroupIds:
- !Ref SSHSecurityGroup
- !Ref LocalSecurityGroup
- !Ref RedisSecurityGroup
PrivateIpAddress: 10.0.1.101
InstanceType: !Ref ServerInstanceType
ImageId: !Ref AMI
KeyName: !Ref KeyName
ViewerInstance1:
Type: AWS::EC2::Instance
Properties:
SubnetId: !Ref PublicSubnetB
SecurityGroupIds:
- !Ref SSHSecurityGroup
- !Ref LocalSecurityGroup
- !Ref ViewerSecurityGroup
PrivateIpAddress: 10.0.2.111
InstanceType: !Ref ViewerInstanceType
ImageId: !Ref AMI
KeyName: !Ref KeyName
ServerInstance2:
Type: AWS::EC2::Instance
Properties:
SubnetId: !Ref PublicSubnetB
SecurityGroupIds:
- !Ref SSHSecurityGroup
- !Ref LocalSecurityGroup
- !Ref RedisSecurityGroup
PrivateIpAddress: 10.0.2.101
InstanceType: !Ref ServerInstanceType
ImageId: !Ref AMI
KeyName: !Ref KeyName
LoadTestInstance1:
Type: AWS::EC2::Instance
Properties:
SubnetId: !Ref PublicSubnetA
SecurityGroupIds:
- !Ref SSHSecurityGroup
- !Ref LocalSecurityGroup
PrivateIpAddress: 10.0.1.201
InstanceType: !Ref ClientInstanceType
ImageId: !Ref AMI
KeyName: !Ref KeyName
# TODO - update this to use looping syntax
Outputs:
Server1PublicIP:
Value: !GetAtt
- ServerInstance1
- PublicIp
Server1PrivateIP:
Value: !GetAtt
- ServerInstance1
- PrivateIp
Server2PublicIP:
Value: !GetAtt
- ServerInstance2
- PublicIp
Server2PrivateIP:
Value: !GetAtt
- ServerInstance2
- PrivateIp
LoadTest1PublicIP:
Value: !GetAtt
- LoadTestInstance1
- PublicIp
LoadTest1PrivateIP:
Value: !GetAtt
- LoadTestInstance1
- PrivateIp
Viewer1PublicIP:
Value: !GetAtt
- ViewerInstance1
- PublicIp
Viewer1PrivateIP:
Value: !GetAtt
- ViewerInstance1
- PrivateIp