Skip to content

Commit 8374fff

Browse files
committed
Use nodegroup instead of setting up our own EC2 instances etc
1 parent 9a3cd44 commit 8374fff

File tree

12 files changed

+463
-551
lines changed

12 files changed

+463
-551
lines changed

README.rst

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -132,27 +132,6 @@ typically take the longest to finish, and the EB environment or ECS service crea
132132
will not begin until all of its dependencies, including the CloudFront distribution and RDS
133133
instance, have been created.
134134

135-
EKS Worker Nodes
136-
----------------
137-
138-
The EKS stack includes EKS worker nodes, however, they will not be allowed to join the cluster
139-
until you specifically grant them access as described in the `AWS EKS User Guide
140-
<https://docs.aws.amazon.com/eks/latest/userguide/launch-workers.html>`_. In short, you need to:
141-
142-
1. Download the AWS IAM Authenticator configuration map template from AWS::
143-
144-
curl -o aws-auth-cm.yaml https://amazon-eks.s3-us-west-2.amazonaws.com/cloudformation/2019-10-08/aws-auth-cm.yaml
145-
146-
2. Open the file with your favorite text editor. Replace the ``<ARN of instance role (not instance profile)>``
147-
snippet with the ``ContainerInstanceRole`` ARN from the stack that you created, and save the file.
148-
**Important:** Do not modify any other lines in this file.
149-
150-
3. Apply the configuration::
151-
152-
kubectl apply -f aws-auth-cm.yaml
153-
154-
If you your nodes still aren't joining the cluster, consult the AWS EKS User Guide.
155-
156135
SSL Certificate
157136
---------------
158137

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
awacs==0.9.6
2-
troposphere==2.5.2
2+
troposphere==2.5.3
33
flake8==3.4.1
44
isort==4.2.15
55
sphinx==1.6.7

stack/__init__.py

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
11
import os
22

3-
from . import sftp # noqa: F401
4-
from . import assets # noqa: F401
5-
from . import cache # noqa: F401
6-
from . import database # noqa: F401
7-
from . import logs # noqa: F401
8-
from . import vpc # noqa: F401
9-
from . import template
3+
if os.environ.get("USE_EKS") == "on":
4+
from . import vpc # noqa: F401
5+
from . import template
6+
from . import repository # noqa: F401
7+
from . import eks # noqa: F401
8+
else:
9+
from . import sftp # noqa: F401
10+
from . import assets # noqa: F401
11+
from . import cache # noqa: F401
12+
from . import database # noqa: F401
13+
from . import logs # noqa: F401
14+
from . import vpc # noqa: F401
15+
from . import template
1016

11-
if os.environ.get('USE_GOVCLOUD') != 'on':
12-
# make sure this isn't added to the template for GovCloud, as it's not
13-
# supported in this region
14-
from . import search # noqa: F401
17+
if os.environ.get("USE_GOVCLOUD") != "on":
18+
# make sure this isn't added to the template for GovCloud, as it's not
19+
# supported in this region
20+
from . import search # noqa: F401
1521

16-
if os.environ.get('USE_NAT_GATEWAY') == 'on':
17-
from . import bastion # noqa: F401
22+
if os.environ.get("USE_NAT_GATEWAY") == "on":
23+
from . import bastion # noqa: F401
1824

19-
if os.environ.get('USE_ECS') == 'on':
20-
from . import repository # noqa: F401
21-
from . import cluster # noqa: F401
22-
elif os.environ.get('USE_EB') == 'on':
23-
from . import repository # noqa: F401
24-
from . import eb # noqa: F401
25-
elif os.environ.get('USE_DOKKU') == 'on':
26-
from . import dokku # noqa: F401
27-
elif os.environ.get('USE_EKS') == 'on':
28-
from . import repository # noqa: F401
29-
from . import instances # noqa: F401
30-
else: # USE_GOVCLOUD and USE_EC2 both provide EC2 instances
31-
from . import instances # noqa: F401
25+
if os.environ.get("USE_ECS") == "on":
26+
from . import repository # noqa: F401
27+
from . import ecs_cluster # noqa: F401
28+
elif os.environ.get("USE_EB") == "on":
29+
from . import repository # noqa: F401
30+
from . import eb # noqa: F401
31+
elif os.environ.get("USE_DOKKU") == "on":
32+
from . import dokku # noqa: F401
33+
else: # USE_GOVCLOUD and USE_EC2 both provide EC2 instances
34+
from . import instances # noqa: F401
3235

3336
# Must be last to tag all resources
3437
from . import tags # noqa: F401

stack/common.py

Lines changed: 41 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -11,152 +11,53 @@
1111
template.add_condition(in_govcloud_region, Equals(Ref(AWS_REGION), "us-gov-west-1"))
1212
arn_prefix = If(in_govcloud_region, "arn:aws-us-gov", "arn:aws")
1313

14-
administrator_ip_address = Ref(template.add_parameter(
15-
Parameter(
16-
"AdministratorIPAddress",
17-
Description="The IP address allowed to access containers. "
18-
"Defaults to TEST-NET-1 (ie, no valid IP)",
19-
Type="String",
20-
# RFC5737 - TEST-NET-1 reserved for documentation
21-
Default="192.0.2.0/24",
22-
),
23-
group="Application Server",
24-
label="Admin IP Address",
25-
))
26-
27-
container_instance_type = Ref(template.add_parameter(
28-
Parameter(
29-
"ContainerInstanceType",
30-
Description="The application server instance type",
31-
Type="String",
32-
Default="t2.micro",
33-
AllowedValues=[
34-
't3.nano',
35-
't3.micro',
36-
't3.small',
37-
't3.medium',
38-
't3.large',
39-
't3.xlarge',
40-
't3.2xlarge',
41-
't2.nano',
42-
't2.micro',
43-
't2.small',
44-
't2.medium',
45-
't2.large',
46-
't2.xlarge',
47-
't2.2xlarge',
48-
'm5.large',
49-
'm5.xlarge',
50-
'm5.2xlarge',
51-
'm5.4xlarge',
52-
'm5.12xlarge',
53-
'm5.24xlarge',
54-
'm5d.large',
55-
'm5d.xlarge',
56-
'm5d.2xlarge',
57-
'm5d.4xlarge',
58-
'm5d.12xlarge',
59-
'm5d.24xlarge',
60-
'm4.large',
61-
'm4.xlarge',
62-
'm4.2xlarge',
63-
'm4.4xlarge',
64-
'm4.10xlarge',
65-
'm4.16xlarge',
66-
'm3.medium',
67-
'm3.large',
68-
'm3.xlarge',
69-
'm3.2xlarge',
70-
'c5.large',
71-
'c5.xlarge',
72-
'c5.2xlarge',
73-
'c5.4xlarge',
74-
'c5.9xlarge',
75-
'c5.18xlarge',
76-
'c5d.large',
77-
'c5d.xlarge',
78-
'c5d.2xlarge',
79-
'c5d.4xlarge',
80-
'c5d.9xlarge',
81-
'c5d.18xlarge',
82-
'c4.large',
83-
'c4.xlarge',
84-
'c4.2xlarge',
85-
'c4.4xlarge',
86-
'c4.8xlarge',
87-
'c3.large',
88-
'c3.xlarge',
89-
'c3.2xlarge',
90-
'c3.4xlarge',
91-
'c3.8xlarge',
92-
'p2.xlarge',
93-
'p2.8xlarge',
94-
'p2.16xlarge',
95-
'g2.2xlarge',
96-
'g2.8xlarge',
97-
'x1.16large',
98-
'x1.32xlarge',
99-
'r5.large',
100-
'r5.xlarge',
101-
'r5.2xlarge',
102-
'r5.4xlarge',
103-
'r5.12xlarge',
104-
'r5.24xlarge',
105-
'r4.large',
106-
'r4.xlarge',
107-
'r4.2xlarge',
108-
'r4.4xlarge',
109-
'r4.8xlarge',
110-
'r4.16xlarge',
111-
'r3.large',
112-
'r3.xlarge',
113-
'r3.2xlarge',
114-
'r3.4xlarge',
115-
'r3.8xlarge',
116-
'i3.large',
117-
'i3.xlarge',
118-
'i3.2xlarge',
119-
'i3.4xlarge',
120-
'i3.8xlarge',
121-
'i3.16large',
122-
'd2.xlarge',
123-
'd2.2xlarge',
124-
'd2.4xlarge',
125-
'd2.8xlarge',
126-
'f1.2xlarge',
127-
'f1.16xlarge',
128-
]
129-
),
130-
group="Application Server",
131-
label="Instance Type",
132-
))
133-
134-
if "on" in set([os.getenv("USE_DOKKU"), os.getenv("USE_EB"), os.getenv("USE_ECS")]):
135-
secret_key = Ref(template.add_parameter(
14+
administrator_ip_address = Ref(
15+
template.add_parameter(
13616
Parameter(
137-
"SecretKey",
138-
Description="Application secret key for this stack (optional)",
17+
"AdministratorIPAddress",
18+
Description="The IP address allowed to access containers. "
19+
"Defaults to TEST-NET-1 (ie, no valid IP)",
13920
Type="String",
140-
NoEcho=True,
21+
# RFC5737 - TEST-NET-1 reserved for documentation
22+
Default="192.0.2.0/24",
14123
),
14224
group="Application Server",
143-
label="Secret Key",
144-
))
25+
label="Admin IP Address",
26+
)
27+
)
14528

146-
use_aes256_encryption = Ref(template.add_parameter(
147-
Parameter(
148-
"UseAES256Encryption",
149-
Description="Whether or not to use server side encryption for S3, EBS, and RDS. "
150-
"When true, encryption is enabled for all resources.",
151-
Type="String",
152-
AllowedValues=["true", "false"],
153-
Default="false",
154-
),
155-
group="Global",
156-
label="Enable Encryption",
157-
))
29+
if "on" in set([os.getenv("USE_DOKKU"), os.getenv("USE_EB"), os.getenv("USE_ECS")]):
30+
secret_key = Ref(
31+
template.add_parameter(
32+
Parameter(
33+
"SecretKey",
34+
Description="Application secret key for this stack (optional)",
35+
Type="String",
36+
NoEcho=True,
37+
),
38+
group="Application Server",
39+
label="Secret Key",
40+
)
41+
)
42+
43+
use_aes256_encryption = Ref(
44+
template.add_parameter(
45+
Parameter(
46+
"UseAES256Encryption",
47+
Description="Whether or not to use server side encryption for S3, EBS, and RDS. "
48+
"When true, encryption is enabled for all resources.",
49+
Type="String",
50+
AllowedValues=["true", "false"],
51+
Default="false",
52+
),
53+
group="Global",
54+
label="Enable Encryption",
55+
)
56+
)
15857
use_aes256_encryption_cond = "UseAES256EncryptionCond"
159-
template.add_condition(use_aes256_encryption_cond, Equals(use_aes256_encryption, "true"))
58+
template.add_condition(
59+
use_aes256_encryption_cond, Equals(use_aes256_encryption, "true")
60+
)
16061

16162
cmk_arn = template.add_parameter(
16263
Parameter(

0 commit comments

Comments
 (0)