-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab2-rds_stack.json
More file actions
176 lines (154 loc) · 5.21 KB
/
Lab2-rds_stack.json
File metadata and controls
176 lines (154 loc) · 5.21 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
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create an RDS DBInstance in an existing Virtual Private Cloud (VPC). **WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"VpcId" : {
"Type" : "String",
"Description" : "VpcId of your existing Virtual Private Cloud (VPC)"
},
"PrivateRouteTableID" : {
"Type" : "String",
"Description" : "ID of the private route table in your VPC that will use the NAT instance as default path to 0.0.0.0/0"
},
"DBName": {
"Default": "MyDatabase",
"Description" : "The database name",
"Type": "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DBUsername": {
"Default": "admin",
"Description" : "The database admin account username",
"Type": "String",
"MinLength": "1",
"MaxLength": "16",
"AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*",
"ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters."
},
"DBPassword": {
"Default": "admin123",
"NoEcho": "true",
"Description" : "The database admin account password",
"Type": "String",
"MinLength": "8",
"MaxLength": "41",
"ConstraintDescription" : "Minimum of 8 characters"
}
},
"Resources" : {
"PrivateSubnetA" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"VpcId" : { "Ref" : "VpcId" },
"AvailabilityZone" : "us-west-2a",
"CidrBlock" : "192.168.101.0/24",
"Tags" : [
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} },
{"Key" : "Network", "Value" : "PrivateSubnetA" }
]
}
},
"PrivateSubnetARouteTableAssociation" : {
"Type" : "AWS::EC2::SubnetRouteTableAssociation",
"Properties" : {
"SubnetId" : { "Ref" : "PrivateSubnetA" },
"RouteTableId" : { "Ref" : "PrivateRouteTableID" }
}
},
"PrivateSubnetB" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"VpcId" : { "Ref" : "VpcId" },
"AvailabilityZone" : "us-west-2b",
"CidrBlock" : "192.168.102.0/24",
"Tags" : [
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} },
{"Key" : "Network", "Value" : "PrivateSubnetB" }
]
}
},
"PrivateSubnetBRouteTableAssociation" : {
"Type" : "AWS::EC2::SubnetRouteTableAssociation",
"Properties" : {
"SubnetId" : { "Ref" : "PrivateSubnetB" },
"RouteTableId" : { "Ref" : "PrivateRouteTableID" }
}
},
"PrivateSubnetC" : {
"Type" : "AWS::EC2::Subnet",
"Properties" : {
"VpcId" : { "Ref" : "VpcId" },
"AvailabilityZone" : "us-west-2c",
"CidrBlock" : "192.168.103.0/24",
"Tags" : [
{"Key" : "Application", "Value" : { "Ref" : "AWS::StackName"} },
{"Key" : "Network", "Value" : "PrivateSubnetC" }
]
}
},
"PrivateSubnetCRouteTableAssociation" : {
"Type" : "AWS::EC2::SubnetRouteTableAssociation",
"Properties" : {
"SubnetId" : { "Ref" : "PrivateSubnetC" },
"RouteTableId" : { "Ref" : "PrivateRouteTableID" }
}
},
"MyDBSubnetGroup" : {
"Type" : "AWS::RDS::DBSubnetGroup",
"Properties" : {
"DBSubnetGroupDescription" : "Subnets available for the RDS DB Instance",
"SubnetIds" : [{ "Ref" : "PrivateSubnetA" },{ "Ref" : "PrivateSubnetB" },{ "Ref" : "PrivateSubnetC" }]
}
},
"MyDBSecurityGroup" : {
"Type" : "AWS::RDS::DBSecurityGroup",
"Properties" : {
"GroupDescription" : "Security group for RDS DB Instance",
"DBSecurityGroupIngress" : {
"CIDRIP" : "192.168.0.0/16"
},
"EC2VpcId" : { "Ref" : "VpcId" }
}
},
"MyDB" : {
"Type" : "AWS::RDS::DBInstance",
"Properties" : {
"DBName" : { "Ref" : "DBName" },
"AllocatedStorage" : "50",
"DBInstanceClass" : "db.m1.large",
"Engine" : "MySQL",
"EngineVersion" : "5.6",
"MultiAZ" : "true",
"MasterUsername" : { "Ref" : "DBUsername" } ,
"MasterUserPassword" : { "Ref" : "DBPassword" },
"DBSubnetGroupName" : { "Ref" : "MyDBSubnetGroup" },
"DBSecurityGroups" : [ { "Ref" : "MyDBSecurityGroup" } ]
}
}
},
"Outputs" : {
"DBConnectionName" : {
"Value" : { "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] },
"Description" : "DNS name for this RDS instance."
},
"DatabaseName" : {
"Value" : { "Ref": "DBName" },
"Description" : "Name of pre-created database"
},
"PrivateSubnetA" : {
"Value" : {"Ref" : "PrivateSubnetA"},
"Description" : "Private Subnet in AZ A"
},
"PrivateSubnetB" : {
"Value" : {"Ref" : "PrivateSubnetB"},
"Description" : "Private Subnet in AZ B"
},
"PrivateSubnetC" : {
"Value" : {"Ref" : "PrivateSubnetC"},
"Description" : "Private Subnet in AZ C"
}
}
}