-
Notifications
You must be signed in to change notification settings - Fork 0
/
database-stack.yml
72 lines (69 loc) · 1.73 KB
/
database-stack.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
Description: Create database server
Parameters:
DBSubnetGroup:
Type: String
Description: Enter a valid DB Subnet Group
DBUsername:
Type: String
Description: Enter a valid Database master username
MinLength: 1
MaxLength: 16
AllowedPattern: "[a-zA-Z][a-zA-Z0-9]*"
DBPassword:
Type: String
Description: Enter a valid Database master password
NoEcho: true
MinLength: 1
MaxLength: 41
AllowedPattern: "[a-zA-Z0-9]*"
DBServerSecurityGroup:
Type: "AWS::EC2::SecurityGroup::Id"
Description: Enter a valid security group ID for database
DBInstanceType:
Type: String
Description: Enter one of the possible instance type for database
AllowedValues:
- db.t2.micro
- db.t2.small
- db.t2.medium
- db.t2.large
Environment:
Type: String
Description: Select the appropriate environment
AllowedValues:
- dev
- test
- uat
- prod
Resources:
DBServer:
Type: "AWS::RDS::DBInstance"
Properties:
AllocatedStorage: 50
AllowMajorVersionUpgrade: true
AutoMinorVersionUpgrade: true
BackupRetentionPeriod: 0
DBInstanceClass:
Ref: DBInstanceType
DBSubnetGroupName:
Ref: DBSubnetGroup
Engine: mysql
EngineVersion: 5.7.30
MasterUsername:
Ref: DBUsername
MasterUserPassword:
Ref: DBPassword
MultiAZ: false
PubliclyAccessible: false
StorageType: gp2
VPCSecurityGroups:
- Ref: DBServerSecurityGroup
Tags:
- Key: Name
Value:
Fn::Sub: DBServer-${Environment}
Outputs:
DBEndpoint:
Description: "URL endpoint of database"
Value:
Fn::GetAtt: [ DBServer, Endpoint.Address ]