-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCF_RDS.json
More file actions
executable file
·211 lines (211 loc) · 6.62 KB
/
CF_RDS.json
File metadata and controls
executable file
·211 lines (211 loc) · 6.62 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "RDS CF Template",
"Parameters": {
"ProjectName": {
"Description": "Project Name for CF Template",
"Type": "String",
"AllowedPattern": "[a-zA-Z0-9]+",
"Default": "CodyKurtz"
},
"InstanceType": {
"Description": "RDS instance type.",
"Type": "String",
"Default": "db.t2.micro"
},
"DBEngine": {
"Description": "RDS engine type.",
"Type": "String",
"Default": "oracle-ee"
},
"EngineVersion": {
"Description": "Version of the database engine, e.g. 11.2",
"Type": "String",
"Default": "11.2"
},
"MinorEngineVersion": {
"Description": "Version of the database engine, e.g. 0.4",
"Type": "String",
"Default": "0.4"
},
"OracleEngineVersion": {
"Description": "Version of the database engine, e.g. v1",
"Type": "String",
"Default": "v1"
},
"RDSUsername": {
"Description": "Master username for RDS instance.",
"Type": "String",
"Default": "Admin"
},
"RDSPassword": {
"Description": "Master password for RDS instance.",
"Type": "String",
"MinLength": "8",
"MaxLength": "41",
"ConstraintDescription": "Must contain between 8 to 41 characters",
"NoEcho": "true",
"Default": "Password"
},
"DBSnapshotIDToRestore": {
"Description": "Identifier of a database snapshot to restore (leave blank for a clean database)",
"Type": "String",
"Default": ""
}
},
"Conditions": {
"ShouldRestoreFromSnapshot": {
"Fn::Not": [
{
"Fn::Equals": [
{
"Ref": "DBSnapshotIDToRestore"
},
""
]
}
]
}
},
"Resources": {
"RDSDBParameterGroup": {
"Type": "AWS::RDS::DBParameterGroup",
"Properties": {
"Description": "RDS Parameter Group",
"Family": {
"Fn::Sub": "${DBEngine}-${EngineVersion}"
},
"Parameters": {
"compatible": {
"Fn::Sub": "${EngineVersion}.${MinorEngineVersion}"
}
},
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "RDSDBParamGroup-${ProjectName}"
}
}
]
}
},
"RDSSubnetGroup": {
"Type": "AWS::RDS::DBSubnetGroup",
"Properties": {
"DBSubnetGroupDescription": "RDS Subnet Group",
"SubnetIds": [
{
"Fn::ImportValue": {
"Fn::Sub": "${ProjectName}-PrivateSubnetA"
}
},
{
"Fn::ImportValue": {
"Fn::Sub": "${ProjectName}-PrivateSubnetB"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "RDSDBSubnetGroup-${ProjectName}"
}
}
]
}
},
"RDSInstance": {
"Type": "AWS::RDS::DBInstance",
"DeletionPolicy": "Delete",
"Properties": {
"AllocatedStorage": "10",
"BackupRetentionPeriod": "7",
"DBInstanceClass": {
"Ref": "InstanceType"
},
"DBParameterGroupName": {
"Ref": "RDSDBParameterGroup"
},
"DBSnapshotIdentifier": {
"Fn::If": [
"ShouldRestoreFromSnapshot",
{
"Ref": "DBSnapshotIDToRestore"
},
{
"Ref": "AWS::NoValue"
}
]
},
"DBInstanceIdentifier": {
"Fn::Sub": "${ProjectName}-RDSInstance"
},
"DBSubnetGroupName": {
"Ref": "RDSSubnetGroup"
},
"Engine": {
"Ref": "DBEngine"
},
"EngineVersion": {
"Fn::Sub": "${EngineVersion}.${MinorEngineVersion}.${OracleEngineVersion}"
},
"MasterUsername": {
"Ref": "RDSUsername"
},
"MasterUserPassword": {
"Ref": "RDSPassword"
},
"MultiAZ": "true",
"PreferredBackupWindow": "1:00-1:30",
"PreferredMaintenanceWindow": "tue:1:35-tue:2:05",
"VPCSecurityGroups": [
{
"Fn::ImportValue": {
"Fn::Sub": "${ProjectName}-DataSG"
}
}
],
"Tags": [
{
"Key": "Name",
"Value": {
"Fn::Sub": "RDSInstance-${ProjectName}"
}
}
]
}
}
},
"Outputs": {
"RDSInstanceAddress": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"Endpoint.Address"
]
},
"Description": "RDS HA endpoint address",
"Export": {
"Name": {
"Fn::Sub": "${ProjectName}-RDSInstanceAddress"
}
}
},
"RDSPort": {
"Value": {
"Fn::GetAtt": [
"RDSInstance",
"Endpoint.Port"
]
},
"Description": "RDS HA port",
"Export": {
"Name": {
"Fn::Sub": "${ProjectName}-RDSInstancePort"
}
}
}
}
}