Skip to content

Commit 0292ff2

Browse files
Dan van den BergDaniel van den Berg
authored andcommitted
feat(contrib/ec2/gen-json.py): split private and public subnets
When installing a Deis cluster in an existing VPC, it is currently only possible to specify one set of (public) subnets in which both the Deis EC2 instances and the ELB are placed. It is not possible to enhance security by placing the Deis hosts in a private section of the VPC, into subnets that have no direct connection to the Internet. This change adds the environment variable `VPC_PRIVATE_SUBNETS` to help set up a Deis cluster in a 'split' VPC environment.
1 parent 6f00f9b commit 0292ff2

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

contrib/ec2/gen-json.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989

9090
VPC_ID = os.getenv('VPC_ID', None)
9191
VPC_SUBNETS = os.getenv('VPC_SUBNETS', None)
92+
VPC_PRIVATE_SUBNETS = os.getenv('VPC_PRIVATE_SUBNETS', VPC_SUBNETS)
9293
VPC_ZONES = os.getenv('VPC_ZONES', None)
9394

9495
if VPC_ID and VPC_SUBNETS and VPC_ZONES and len(VPC_SUBNETS.split(',')) == len(VPC_ZONES.split(',')):
@@ -111,7 +112,7 @@
111112

112113
# update subnets and zones
113114
template['Resources']['CoreOSServerAutoScale']['Properties']['AvailabilityZones'] = VPC_ZONES.split(',')
114-
template['Resources']['CoreOSServerAutoScale']['Properties']['VPCZoneIdentifier'] = VPC_SUBNETS.split(',')
115+
template['Resources']['CoreOSServerAutoScale']['Properties']['VPCZoneIdentifier'] = VPC_PRIVATE_SUBNETS.split(',')
115116
template['Resources']['DeisWebELB']['Properties']['Subnets'] = VPC_SUBNETS.split(',')
116117

117118
print json.dumps(template)

docs/installing_deis/aws.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@ For example, if your VPC has ID ``vpc-a26218bf`` and consists of the subnets ``s
140140
export VPC_SUBNETS=subnet-04d7f942,subnet-2b03ab7f
141141
export VPC_ZONES=us-east-1b,us-east-1c
142142
143+
If you have set up private subnets in which you'd like to run your Deis hosts, and public subnets
144+
for the ELB, you should export the following environment variables instead:
145+
146+
- ``VPC_ID``
147+
- ``VPC_SUBNETS``
148+
- ``VPC_PRIVATE_SUBNETS``
149+
- ``VPC_ZONES``
150+
151+
For example, if you have a public subnet ``subnet-8cd457b3`` for the ELB and a private subnet
152+
``subnet-8cd457b0`` (both in ``us-east-1a``) you would export:
153+
154+
.. code-block:: console
155+
156+
export VPC_ID=vpc-a26218bf
157+
export VPC_SUBNETS=subnet-8cd457b3
158+
export VPC_PRIVATE_SUBNETS=subnet-8cd457b0
159+
export VPC_ZONES=us-east-1a
160+
143161
144162
Run the Provision Script
145163
------------------------

0 commit comments

Comments
 (0)