-
Notifications
You must be signed in to change notification settings - Fork 2
/
WPECSStack.yml
191 lines (190 loc) · 6.46 KB
/
WPECSStack.yml
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
AWSTemplateFormatVersion: 2010-09-09
Description: Master stack which creates all required nested stacks
Parameters:
TemplatePath:
Type: String
Description: S3 Bucket Path where the templates are stored
Environment:
Type: String
Description: Select the appropriate environment
AllowedValues:
- dev
- test
- uat
- prod
VPCCIDR:
Type: String
Description: CIDR block should be used to create the VPC (e.g. 172.21.1.0/24)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.0/24)
PublicSubnet1CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ1 (e.g. 172.21.1.0/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.0/26)
PublicSubnet2CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ2 (e.g. 172.21.1.64/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.64/26)
PublicSubnet3CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ3 (e.g. 172.21.1.64/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.64/26)
PrivateSubnet1CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ1 (e.g. 172.21.1.128/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.128/26)
PrivateSubnet2CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ2 (e.g. 172.21.1.192/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.192/26)
PrivateSubnet3CIDR:
Type: String
Description: CIDR block should be used to create the public subnet in AZ3 (e.g. 172.21.1.192/26)
AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{2})"
ConstraintDescription: Must be a valid IP CIDR range of the form x.x.x.x/x. (e.g. 172.21.1.192/26)
ClusterName:
Type: String
Description: Name of cluster
TagPrefix:
Type: String
Description: Enter Prefix that should be used for Tags.
MasterUsername:
Default: 'wordpress'
Type: String
Description: Specify database root username
MasterUserPassword:
Default: 'somethingstrong'
Type: String
Description: Specify database password
DBName:
Default: 'WordPressDB'
Type: String
Description: Database name
RDSDBEngine:
Type: String
Description: Database Engine Version
Default: aurora
AllowedValues:
- aurora
- aurora-mysql
- aurora-postgresql
RDSEngineMode:
Type: String
Description: Database Engine mode
Default: serverless
AllowedValues:
- serverless
- provisioned
- parallelquery
- global
RDSInstaceType:
Type: String
Description: Database instace type
Default: db.r5.large
AllowedValues:
- db.t2.small
- db.t2.medium
- db.t3.small
- db.t3.medium
- db.r3.large
- db.r3.xlarge
- db.r3.2xlarge
- db.r3.4xlarge
- db.r3.8xlarge
- db.r4.large
- db.r4.xlarge
- db.r4.2xlarge
- db.r4,4xlarge
- db.r4.8xlarge
- db.r4.16xlarge
- db.r5.large
- db.r5.2xlarge
- db.r5.4xlarge
- db.r5.12xlarge
Resources:
VPCStack:
Type: "AWS::CloudFormation::Stack"
Properties:
TemplateURL:
Fn::Sub: "https://s3.amazonaws.com/${TemplatePath}/vpc-stack.yml"
Parameters:
VPCCIDR: !Ref VPCCIDR
PublicSubnet1CIDR: !Ref PublicSubnet1CIDR
PublicSubnet2CIDR: !Ref PublicSubnet2CIDR
PublicSubnet3CIDR: !Ref PublicSubnet3CIDR
PrivateSubnet1CIDR: !Ref PrivateSubnet1CIDR
PrivateSubnet2CIDR: !Ref PrivateSubnet2CIDR
PrivateSubnet3CIDR: !Ref PrivateSubnet3CIDR
TagPrefix: !Ref TagPrefix
Tags:
- Key: Name
Value: VPCStack
- Key: Parent
Value: WPECSStack
- Key: Environment
Value: !Ref Environment
SecurityStack:
Type: "AWS::CloudFormation::Stack"
DependsOn:
- VPCStack
Properties:
TemplateURL:
Fn::Sub: "https://s3.amazonaws.com/${TemplatePath}/security-stack.yml"
Parameters:
VPCID: !GetAtt VPCStack.Outputs.VPCID
Tags:
- Key: Name
Value: SecurityStack
- Key: Parent
Value: WPECSStack
- Key: Environment
Value: !Ref Environment
ECSStack:
Type: "AWS::CloudFormation::Stack"
DependsOn:
- SecurityStack
Properties:
TemplateURL:
Fn::Sub: "https://s3.amazonaws.com/${TemplatePath}/ecs-stack.yml"
Parameters:
VPCID: !GetAtt VPCStack.Outputs.VPCID
ClusterName: !Ref ClusterName
PublicSubnets: !GetAtt VPCStack.Outputs.PublicSubnets
SecurityGroups: !GetAtt SecurityStack.Outputs.SecurityGroups
TagPrefix: !Ref TagPrefix
Tags:
- Key: Name
Value: ECSStack
- Key: Parent
Value: WPECSStack
- Key: Environment
Value: !Ref Environment
RDSStack:
Type: "AWS::CloudFormation::Stack"
DependsOn:
- SecurityStack
Properties:
TemplateURL:
Fn::Sub: "https://s3.amazonaws.com/${TemplatePath}/rds-stack.yml"
Parameters:
Environment: !Ref Environment
PrivateSubnets: !GetAtt VPCStack.Outputs.PrivateSubnets
SecurityGroups: !GetAtt SecurityStack.Outputs.SecurityGroups
MasterUsername: !Ref MasterUsername
MasterUserPassword: !Ref MasterUserPassword
DBName: !Ref DBName
RDSDBEngine: !Ref RDSDBEngine
RDSEngineMode: !Ref RDSEngineMode
RDSInstaceType: !Ref RDSInstaceType
Tags:
- Key: Name
Value: ECSStack
- Key: Parent
Value: WPECSStack
- Key: Environment
Value: !Ref Environment