Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 62b2f42

Browse files
committed
Added VaultSG tied ConsulMaster to Vault UserData
1 parent f43c0c3 commit 62b2f42

File tree

2 files changed

+67
-20
lines changed

2 files changed

+67
-20
lines changed

templates/quickstart-hashicorp-vault-master.template

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "Hashicorp Consul+Vault template master, License: Apache 2.0 (Please do not remove) Oct,26,2016",
3+
"Description": "Hashicorp Consul+Vault template master, License: Apache 2.0 (Please do not remove) Oct,27,2016",
44
"Metadata": {
55
"AWS::CloudFormation::Interface": {
66
"ParameterGroups": [{
@@ -481,6 +481,13 @@
481481
]
482482
},
483483
"Parameters": {
484+
"AvailabilityZones": {
485+
"Fn::Join": [
486+
",", {
487+
"Ref": "AvailabilityZones"
488+
}
489+
]
490+
},
484491
"PrivateSubnet1ID": {
485492
"Fn::GetAtt": [
486493
"VPCStack",
@@ -514,6 +521,9 @@
514521
"AccessCIDR": {
515522
"Ref": "AccessCIDR"
516523
},
524+
"EmailAddress": {
525+
"Ref": "EmailAddress"
526+
},
517527
"QuickStartS3URL": {
518528
"Fn::Join": [
519529
"/", [{

templates/quickstart-hashicorp-vault.template

Lines changed: 56 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"AWSTemplateFormatVersion": "2010-09-09",
3-
"Description": "QS(0037) HashiCorp Consul License: Apache 2.0 (Please do not remove) Oct,26,2016",
3+
"Description": "QS(0037) HashiCorp Consul License: Apache 2.0 (Please do not remove) Oct,27,2016",
44
"Parameters": {
5+
"AvailabilityZones": {
6+
"Description": "List of Availability Zones to use for the subnets in the VPC. Note: The logical order is preserved and only 2 AZs are used for this deployment.",
7+
"Type": "List<AWS::EC2::AvailabilityZone::Name>"
8+
},
59
"KeyPair": {
610
"Description": "Name of an existing EC2 KeyPair to enable SSH access to the instances",
711
"Type": "AWS::EC2::KeyPair::KeyName",
@@ -157,6 +161,37 @@
157161
}]
158162
}
159163
},
164+
"VaultSecGroup": {
165+
"Type": "AWS::EC2::SecurityGroup",
166+
"Properties": {
167+
"GroupDescription": "Enables SSH access to the Consul Master.",
168+
"VpcId": {
169+
"Ref": "VPCID"
170+
},
171+
"SecurityGroupIngress": [
172+
{
173+
"IpProtocol": "tcp",
174+
"FromPort": "22",
175+
"ToPort": "22",
176+
"CidrIp": {
177+
"Ref": "AccessCIDR"
178+
}
179+
},
180+
{
181+
"IpProtocol": "tcp",
182+
"FromPort": "0",
183+
"ToPort": "65535",
184+
"CidrIp": {
185+
"Ref": "VPCCIDR"
186+
}
187+
}
188+
],
189+
"Tags": [{
190+
"Key": "Name",
191+
"Value": "VaultSecGroup"
192+
}]
193+
}
194+
},
160195
"Vault1MemoryAlarm": {
161196
"Type": "AWS::CloudWatch::Alarm",
162197
"Properties": {
@@ -342,21 +377,22 @@
342377
}
343378
},
344379
"Properties": {
345-
"AvailabilityZone": {
346-
"Fn::Select": [
347-
"0", {
348-
"Fn::GetAZs": {
349-
"Ref": "AWS::Region"
350-
}
351-
}
352-
]
353-
},
354380
"InstanceType": {
355381
"Ref": "VaultInstanceType"
356382
},
357383
"KeyName": {
358384
"Ref": "KeyPair"
359385
},
386+
"NetworkInterfaces": [{
387+
"DeleteOnTermination": "true",
388+
"DeviceIndex": 0,
389+
"SubnetId": {
390+
"Ref": "PrivateSubnet1ID"
391+
},
392+
"GroupSet": [{
393+
"Ref": "VaultSecGroup"
394+
}]
395+
}],
360396
"ImageId": {
361397
"Fn::FindInMap": [
362398
"AWSAMIRegionMap", {
@@ -542,21 +578,22 @@
542578
}
543579
},
544580
"Properties": {
545-
"AvailabilityZone": {
546-
"Fn::Select": [
547-
"1", {
548-
"Fn::GetAZs": {
549-
"Ref": "AWS::Region"
550-
}
551-
}
552-
]
553-
},
554581
"InstanceType": {
555582
"Ref": "VaultInstanceType"
556583
},
557584
"KeyName": {
558585
"Ref": "KeyPair"
559586
},
587+
"NetworkInterfaces": [{
588+
"DeleteOnTermination": "true",
589+
"DeviceIndex": 0,
590+
"SubnetId": {
591+
"Ref": "PrivateSubnet2ID"
592+
},
593+
"GroupSet": [{
594+
"Ref": "VaultSecGroup"
595+
}]
596+
}],
560597
"ImageId": {
561598
"Fn::FindInMap": [
562599
"AWSAMIRegionMap", {

0 commit comments

Comments
 (0)