forked from wso2-attic/aws-is
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdatabase.yaml
More file actions
184 lines (183 loc) · 5.68 KB
/
database.yaml
File metadata and controls
184 lines (183 loc) · 5.68 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
# Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
AWSTemplateFormatVersion: 2010-09-09
Description: >-
WSO2 Identity Server High Availabile Deployment - Database
Metadata:
'AWS::CloudFormation::Interface':
ParameterGroups:
- Label:
default: Basic Configuration
Parameters:
- DBUsername
- DBPassword
- Label:
default: Advanced Configuration
Parameters:
- DB
- DBAllocationStorage
- DBInstanceType
- WSO2VPC
- WSO2PrivateSubnet1
- WSO2PrivateSubnet2
ParameterLabels:
DB:
default: Database
DBUsername:
default: DB Username
DBPassword:
default: DB Password
DBAllocationStorage:
default: Allocation Storage
DBInstanceType:
default: DB Instance Type
WSO2VPC:
default: VPC ID
WSO2PrivateSubnet1:
default: WSO2 Private Subnet 1 - ID
WSO2PrivateSubnet2:
default: WSO2 Private Subnet 2 - ID
Resources:
WSO2ISDBInstance:
Type: AWS::RDS::DBInstance
DeletionPolicy: Delete
Properties:
VPCSecurityGroups:
- !Ref WSO2ISDBInstanceSecurityGroup
DBInstanceClass: !Ref DBInstanceType
AllocatedStorage: !Ref DBAllocationStorage
BackupRetentionPeriod: '0'
DBInstanceIdentifier: WSO2ISDBInstance
DBName: !If [UseSQLServerDB, "", WSO2ISDB]
LicenseModel: !If [UseLicensedVersion, license-included, !Ref 'AWS::NoValue']
EngineVersion: !Select [1, !Split ["_", !FindInMap [ DBEngineMap, !Ref DB, DBEngine]]]
Engine: !Select [0, !Split ["_", !FindInMap [ DBEngineMap, !Ref DB, DBEngine]]]
MasterUsername: !Ref DBUsername
MasterUserPassword: !Ref DBPassword
MultiAZ: 'false'
StorageType: gp2
DBSubnetGroupName: !Ref WSO2ISDBSubnetGroup
WSO2ISDBSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupDescription: DB Subnet Group
SubnetIds:
- !Ref WSO2PrivateSubnet1
- !Ref WSO2PrivateSubnet2
WSO2ISDBInstanceSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
VpcId: !Ref WSO2VPC
GroupDescription: DB Security Group
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: '3306'
ToPort: '3306'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '5432'
ToPort: '5432'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '1521'
ToPort: '1521'
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: '1433'
ToPort: '1433'
CidrIp: 0.0.0.0/0
Outputs:
WSO2ISDBInstanceSecurityGroup:
Value: !Ref WSO2ISDBInstanceSecurityGroup
Description: Identity Server DB Security Group
WSO2ISDBSubnetGroup:
Value: !Ref WSO2ISDBSubnetGroup
Description: Identity Server DB Subnet Group
WSO2ISDBInstance:
Value: !Ref WSO2ISDBInstance
Description: Identity Server DB Instance
WSO2ISDBInstanceEndpointAddress:
Value: !GetAtt WSO2ISDBInstance.Endpoint.Address
Description: Identity Server DB Instance Endpoint Address
WSO2ISDBInstanceEndpointPort:
Value: !GetAtt WSO2ISDBInstance.Endpoint.Port
Description: Identity Server DB Instance Endpoint Port
Parameters:
DBUsername:
Type: String
MinLength: 4
AllowedPattern: '[A-Za-z0-9\-]+'
DBPassword:
Type: String
MinLength: 8
NoEcho: true
DBAllocationStorage:
Description: Provide storage size in Gigabytes
Type: Number
Default: 200
DBInstanceType:
Type: String
Default: db.t2.medium
AllowedValues:
- db.t2.medium
- db.t2.large
- db.t2.xlarge
- db.t2.2xlarge
- db.m3.medium
- db.m3.large
- db.m3.xlarge
- db.m3.2xlarge
- db.m4.large
- db.m4.xlarge
DB:
Type: String
Default: MySQL-5.7
AllowedValues:
- MySQL-5.7
- Postgres-9.6
- Postgres-10.5
- Oracle-SE1-11.2
- Oracle-SE2-12.1
- SQLServer-SE-13.00
- SQLServer-SE-14.00
WSO2VPC:
Type: AWS::EC2::VPC::Id
Description: VPC ID of your existing Virtual Private Cloud (VPC)
WSO2PrivateSubnet1:
Type: AWS::EC2::Subnet::Id
Description: Private Subnet for PuppetMaster, Prodcut Instance, EFS and the DB
WSO2PrivateSubnet2:
Type: AWS::EC2::Subnet::Id
Description: Private Subnet for Prodcut Instance and the DB
Mappings:
DBEngineMap:
MySQL-5.7:
DBEngine: "mysql_5.7"
MySQL-5.6:
DBEngine: "mysql_5.6"
Postgres-9.6:
DBEngine: "postgres_9.6"
Postgres-10.5:
DBEngine: "postgres_10.5"
SQLServer-SE-13.00:
DBEngine: "sqlserver-se_13.00"
SQLServer-SE-14.00:
DBEngine: "sqlserver-se_14.00"
Oracle-SE1-11.2:
DBEngine: "oracle-se1_11.2"
Oracle-SE2-12.1:
DBEngine: "oracle-se2_12.1"
Conditions:
UseSQLServerDB: !Equals [sqlserver-se, !Select [0, !Split ["_", !FindInMap [ DBEngineMap, !Ref DB, DBEngine]]]]
UseLicensedVersion: !Or [ !Equals [sqlserver, !Select [0, !Split ["-", !FindInMap [ DBEngineMap, !Ref DB, DBEngine]]]], !Equals [oracle, !Select [0, !Split ["-", !FindInMap [ DBEngineMap, !Ref DB, DBEngine]]]] ]