@@ -3,37 +3,39 @@ Transform: 'AWS::Serverless-2016-10-31'
3
3
Description : Deploy Redis Instances in a region
4
4
5
5
Mappings :
6
+
6
7
RegionMap :
7
8
us-east-1 : # Virginia
8
- " EC2AMI" : "ami-0d894ea5521c64557"
9
+ " REDISEC2AMI" : "ami-0d894ea5521c64557"
10
+ " EC2AMI" : "ami-08e4e35cccc6189f4"
9
11
us-east-2 : # Ohio
10
- " EC2AMI " : "ami-082a25bc38620fc4d"
12
+ " REDISEC2AMI " : "ami-082a25bc38620fc4d"
11
13
us-east-3 : # NCALIF
12
- " EC2AMI " : "ami-01773f954c3875420"
14
+ " REDISEC2AMI " : "ami-01773f954c3875420"
13
15
us-west-2 : # Oregon
14
- " EC2AMI " : "ami-05037ab6f618ed336"
16
+ " REDISEC2AMI " : "ami-05037ab6f618ed336"
15
17
ap-south-1 : # Mumbai
16
- " EC2AMI " : "ami-0eefc21aa52001198"
18
+ " REDISEC2AMI " : "ami-0eefc21aa52001198"
17
19
ap-northeast-2 : # Seoul
18
- " EC2AMI " : "ami-0967b7ff9a7ba331e"
20
+ " REDISEC2AMI " : "ami-0967b7ff9a7ba331e"
19
21
ap-southeast-1 : # Singapore
20
- " EC2AMI " : "ami-052d3e5a59fc4a877"
22
+ " REDISEC2AMI " : "ami-052d3e5a59fc4a877"
21
23
ap-southeast-2 : # Sydney
22
- " EC2AMI " : "ami-097cbef0451a30da5"
24
+ " REDISEC2AMI " : "ami-097cbef0451a30da5"
23
25
ap-northeast-1 : # Tokyo
24
- " EC2AMI " : "ami-0ce04ab8bcd5de2e9"
26
+ " REDISEC2AMI " : "ami-0ce04ab8bcd5de2e9"
25
27
eu-central-1 : # Frankfurt
26
- " EC2AMI " : "ami-09304ee2fe70b3aad"
28
+ " REDISEC2AMI " : "ami-09304ee2fe70b3aad"
27
29
eu-west-1 : # Ireland
28
- " EC2AMI " : "ami-03b7776ede7f47475"
30
+ " REDISEC2AMI " : "ami-03b7776ede7f47475"
29
31
eu-west-2 : # London
30
- " EC2AMI " : "ami-0c2b997e5c91153e0"
32
+ " REDISEC2AMI " : "ami-0c2b997e5c91153e0"
31
33
eu-west-3 : # Paris
32
- " EC2AMI " : "ami-0176733f200a89b17"
34
+ " REDISEC2AMI " : "ami-0176733f200a89b17"
33
35
eu-north-1 : # Stockholm
34
- " EC2AMI " : "ami-040e6fa2d290e7b9b"
36
+ " REDISEC2AMI " : "ami-040e6fa2d290e7b9b"
35
37
sa-east-1 : # Sao Paulo
36
- " EC2AMI " : "ami-06d197a564493b29b"
38
+ " REDISEC2AMI " : "ami-06d197a564493b29b"
37
39
38
40
Parameters :
39
41
RedisDatabasePort :
@@ -72,7 +74,7 @@ Parameters:
72
74
MinValue : 1
73
75
MaxValue : 3
74
76
Default : 3
75
- EC2InstanceType :
77
+ RedisEC2InstType :
76
78
Description : Amazon EC2 Instance Type m4 and m5.xlarge 4-16 m5 has better network, 2xlarge 8-13, r4.xlarge 4 30.5, 8 61
77
79
Type : String
78
80
Default : r4.2xlarge
@@ -100,6 +102,37 @@ Parameters:
100
102
- i3.16xlarge
101
103
ConstraintDescription : Must be a valid EC2 instance type.
102
104
105
+ EC2InstType :
106
+ Description : Amazon EC2 Instance Type for app node
107
+ Type : String
108
+ Default : i3.large
109
+ AllowedValues :
110
+ - r4.large
111
+ - r4.xlarge
112
+ - r4.2xlarge
113
+ - r4.4xlarge
114
+ - r4.8xlarge
115
+ - r4.16xlarge
116
+ - m4.large
117
+ - m4.xlarge
118
+ - m4.2xlarge
119
+ - m4.4xlarge
120
+ - m4.10xlarge
121
+ - m4.16xlarge
122
+ - c5a.large
123
+ - c5a.xlarge
124
+ - c5a.2xlarge
125
+ - c5a.4xlarge
126
+ - c5a.8xlarge
127
+ - c5a.16xlarge
128
+ - i3.large
129
+ - i3.xlarge
130
+ - i3.2xlarge
131
+ - i3.4xlarge
132
+ - i3.8xlarge
133
+ - i3.16xlarge
134
+ ConstraintDescription : Must be a valid EC2 instance type.
135
+
103
136
Conditions :
104
137
Create-One : !Equals [ !Ref NumberInstances, 1 ]
105
138
Create-Two : !Equals [ !Ref NumberInstances, 2 ]
@@ -121,7 +154,7 @@ Resources:
121
154
' AWS::CloudFormation::Designer ' :
122
155
id : 7aa57bac-380e-4523-a72b-ef898d0a0367
123
156
124
- RedisEC2N1 :
157
+ RedisEC2VM1 :
125
158
Type : AWS::EC2::Instance
126
159
DependsOn :
127
160
- VPCStack
@@ -130,8 +163,8 @@ Resources:
130
163
Fn::FindInMap :
131
164
- RegionMap
132
165
- !Ref AWS::Region
133
- - EC2AMI
134
- InstanceType : !Ref EC2InstanceType
166
+ - REDISEC2AMI
167
+ InstanceType : !Ref RedisEC2InstType
135
168
SubnetId : !GetAtt VPCStack.Outputs.PublicSubnet1Id
136
169
KeyName : !Ref KeyPair
137
170
SecurityGroupIds :
@@ -160,19 +193,19 @@ Resources:
160
193
tar xvf redislabs-6.2.8-53-rhel7-x86_64.tar
161
194
./install.sh -y
162
195
163
- RedisEC2N2 :
196
+ RedisEC2VM2 :
164
197
Type : AWS::EC2::Instance
165
198
Condition : Do-Two
166
199
DependsOn :
167
200
- VPCStack
168
- - RedisEC2N1
201
+ - RedisEC2VM1
169
202
Properties :
170
203
ImageId :
171
204
Fn::FindInMap :
172
205
- RegionMap
173
206
- !Ref AWS::Region
174
- - EC2AMI
175
- InstanceType : !Ref EC2InstanceType
207
+ - REDISEC2AMI
208
+ InstanceType : !Ref RedisEC2InstType
176
209
SubnetId : !GetAtt VPCStack.Outputs.PublicSubnet1Id
177
210
KeyName : !Ref KeyPair
178
211
SecurityGroupIds :
@@ -194,19 +227,19 @@ Resources:
194
227
tar xvf redislabs-6.2.8-53-rhel7-x86_64.tar
195
228
./install.sh -y
196
229
197
- RedisEC2N3 :
230
+ RedisEC2VM3 :
198
231
Condition : Create-Three
199
232
Type : AWS::EC2::Instance
200
233
DependsOn :
201
234
- VPCStack
202
- - RedisEC2N1
235
+ - RedisEC2VM1
203
236
Properties :
204
237
ImageId :
205
238
Fn::FindInMap :
206
239
- RegionMap
207
240
- !Ref AWS::Region
208
- - EC2AMI
209
- InstanceType : !Ref EC2InstanceType
241
+ - REDISEC2AMI
242
+ InstanceType : !Ref RedisEC2InstType
210
243
SubnetId : !GetAtt VPCStack.Outputs.PublicSubnet1Id
211
244
KeyName : !Ref KeyPair
212
245
SecurityGroupIds :
@@ -228,46 +261,74 @@ Resources:
228
261
tar xvf redislabs-6.2.8-53-rhel7-x86_64.tar
229
262
./install.sh -y
230
263
264
+ AppEC2Instance :
265
+ Type : AWS::EC2::Instance
266
+ DependsOn :
267
+ - VPCStack
268
+ Properties :
269
+ ImageId :
270
+ Fn::FindInMap :
271
+ - RegionMap
272
+ - !Ref AWS::Region
273
+ - EC2AMI
274
+ InstanceType : !Ref EC2InstType
275
+ SubnetId : !GetAtt VPCStack.Outputs.PublicSubnet1Id
276
+ KeyName : !Ref KeyPair
277
+ SecurityGroupIds :
278
+ - !GetAtt VPCStack.Outputs.WorkshopSecurityGroup
279
+ Tags :
280
+ - Key : ' Name'
281
+ Value : !Join ['', [!Ref AWS::StackName, 'APPEC2'] ]
282
+ UserData :
283
+ Fn::Base64 :
284
+ !Sub |
285
+ # !/bin/bash -xe
286
+ sudo bash -l
287
+ yum -y install git wget bind-utils maven java-1.8.0-openjdk
288
+ cd /home/ec2-user
289
+ git clone https://github.com/jphaugla/redisSMSLuaA-A.git
290
+ sudo chown -R ec2-user:ec2-user redisSMSLuaA-A
291
+
231
292
RedisARecord1 :
232
293
Type : AWS::Route53::RecordSet
233
294
DependsOn :
234
- - RedisEC2N1
295
+ - RedisEC2VM1
235
296
Properties :
236
297
HostedZoneId : !Ref HostedZoneId
237
298
Comment : DNS name for my instance
238
299
Name : !Join ['', ['node1.', !Ref ClusterName, ., !Ref HostedZoneName ] ]
239
300
Type : A
240
301
TTL : 900
241
302
ResourceRecords :
242
- - !GetAtt RedisEC2N1 .PublicIp
303
+ - !GetAtt RedisEC2VM1 .PublicIp
243
304
244
305
RedisARecord2 :
245
306
Condition : Do-Two
246
307
Type : AWS::Route53::RecordSet
247
308
DependsOn :
248
- - RedisEC2N2
309
+ - RedisEC2VM2
249
310
Properties :
250
311
HostedZoneId : !Ref HostedZoneId
251
312
Comment : DNS name for my instance
252
313
Name : !Join ['', ['node2.', !Ref ClusterName, ., !Ref HostedZoneName ] ]
253
314
Type : A
254
315
TTL : 900
255
316
ResourceRecords :
256
- - !GetAtt RedisEC2N2 .PublicIp
317
+ - !GetAtt RedisEC2VM2 .PublicIp
257
318
258
319
RedisARecord3 :
259
320
Condition : Create-Three
260
321
Type : AWS::Route53::RecordSet
261
322
DependsOn :
262
- - RedisEC2N3
323
+ - RedisEC2VM3
263
324
Properties :
264
325
HostedZoneId : !Ref HostedZoneId
265
326
Comment : DNS name for my instance
266
327
Name : !Join ['', ['node3.', !Ref ClusterName, ., !Ref HostedZoneName ] ]
267
328
Type : A
268
329
TTL : 900
269
330
ResourceRecords :
270
- - !GetAtt RedisEC2N3 .PublicIp
331
+ - !GetAtt RedisEC2VM3 .PublicIp
271
332
272
333
RedisNSRecord :
273
334
Type : AWS::Route53::RecordSet
@@ -285,31 +346,27 @@ Outputs:
285
346
286
347
Subnets :
287
348
Description : Subnets for workshop
288
- Value : !Join [',', [!GetAtt VPCStack.Outputs.PublicSubnet1Id,!GetAtt VPCStack.Outputs.PublicSubnet2Id,!GetAtt VPCStack.Outputs.PublicSubnet3Id ]]
349
+ Value : !Join [',', [!GetAtt VPCStack.Outputs.PublicSubnet1Id]]
289
350
290
351
WorkshopSecurityGroup :
291
352
Description : ' Security Group'
292
353
Value : !GetAtt VPCStack.Outputs.WorkshopSecurityGroup
293
354
294
- EMRSecurityGroup :
295
- Description : ' Security Group'
296
- Value : !GetAtt VPCStack.Outputs.EMRSecurityGroup
297
-
298
355
RedisInstancePrivateDNS :
299
356
Description : ' Private DNS for Redis EC2 instance'
300
- Value : !GetAtt RedisEC2N1 .PrivateDnsName
357
+ Value : !GetAtt RedisEC2VM1 .PrivateDnsName
301
358
302
359
RedisInstancePublicDNS :
303
360
Description : ' Public DNS for Redis EC2 instance'
304
- Value : !GetAtt RedisEC2N1 .PublicDnsName
361
+ Value : !GetAtt RedisEC2VM1 .PublicDnsName
305
362
306
363
RedisInstancePrivateIP :
307
364
Description : ' Private IP for Redis EC2 instance'
308
- Value : !GetAtt RedisEC2N1 .PrivateIp
365
+ Value : !GetAtt RedisEC2VM1 .PrivateIp
309
366
310
367
RedisInstancePublicIP :
311
368
Description : ' Public IP for Redis EC2 instance'
312
- Value : !GetAtt RedisEC2N1 .PublicIp
369
+ Value : !GetAtt RedisEC2VM1 .PublicIp
313
370
314
371
RedisNSRecord :
315
372
Description : ' The NS Record Name for Redis'
0 commit comments