-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathcreate_docdb_globalcluster.yaml
More file actions
129 lines (128 loc) · 4.2 KB
/
create_docdb_globalcluster.yaml
File metadata and controls
129 lines (128 loc) · 4.2 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
AWSTemplateFormatVersion: 2010-09-09
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: "DocumentDB Configuration"
Parameters:
- GlobalClusterIdentifier
- DocDBClusterIdentifier
- DocDBInstanceType
- DocDBSubnetGroupName
- DocDBSecurityGroup
- DocDBUsername
- DocDBPassword
ParameterLabels:
GlobalClusterIdentifier:
default: "Amazon DocumentDB Global Cluster Identifier"
DocDBClusterIdentifier:
default: "Primary Region Cluster Identifier"
DocDBInstanceType:
default: "Amazon DocumentDB Instance Class"
DocDBSubnetGroupName:
default: "Database Subnet Group"
DocDBSecurityGroup:
default: "Security Group"
DocDBUsername:
default: "Amazon DocumentDB Username"
DocDBPassword:
default: "Amazon DocumentDB Password"
Parameters:
GlobalClusterIdentifier:
Type: String
Description: Identifier used for global Amazon DocumentDB database cluster
AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$'
DocDBClusterIdentifier:
Type: String
Description: Identifier used for regional primary Amazon DocumentDB cluster
AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$'
DocDBSecurityGroup:
Type: List<AWS::EC2::SecurityGroup::Id>
Description: Security group for Amazon DocumentDB primay cluster
AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$'
DocDBInstanceType:
Type: String
AllowedValues:
- db.r6g.large
- db.r6g.xlarge
- db.r6g.2xlarge
- db.r6g.4xlarge
- db.r6g.8xlarge
- db.r6g.12xlarge
- db.r6g.16xlarge
- db.r5.large
- db.r5.xlarge
- db.r5.2xlarge
- db.r5.4xlarge
- db.r5.8xlarge
- db.r5.16xlarge
- db.r5.24xlarge
DocDBSubnetGroupName:
Type: String
Description: Database subnetgroup name for primary region
AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$'
DocDBUsername:
Description: Admin username for DocumentDB
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.
DocDBPassword:
NoEcho: 'true'
Description: Admin password for DocumentDB
Type: String
MinLength: '8'
MaxLength: '41'
AllowedPattern: '[a-zA-Z0-9]*'
ConstraintDescription: must contain only alphanumeric characters.
Resources:
GlobalCluster:
Type: 'AWS::RDS::GlobalCluster'
DependsOn: DocumentDBCluster
Properties:
GlobalClusterIdentifier: !Ref GlobalClusterIdentifier
SourceDBClusterIdentifier: !Ref DocumentDBCluster
DocumentDBCluster:
Type: 'AWS::DocDB::DBCluster'
Properties:
DBClusterIdentifier: !Ref DocDBClusterIdentifier
MasterUsername: !Ref DocDBUsername
MasterUserPassword: !Ref DocDBPassword
DBSubnetGroupName: !Ref DocDBSubnetGroupName
PreferredBackupWindow : 01:00-02:00
PreferredMaintenanceWindow : sat:03:30-sat:05:00
VpcSecurityGroupIds: !Ref DocDBSecurityGroup
DocDBDBInstance:
Type: AWS::DocDB::DBInstance
DependsOn: DocumentDBCluster
Properties:
DBClusterIdentifier: !Ref DocumentDBCluster
DBInstanceClass: !Ref DocDBInstanceType
DBInstanceIdentifier: !Join ["", [!Ref DocDBClusterIdentifier, "1"]]
DocDBDBInstance2:
Type: AWS::DocDB::DBInstance
DependsOn: DocumentDBCluster
Properties:
DBClusterIdentifier: !Ref DocumentDBCluster
DBInstanceClass: !Ref DocDBInstanceType
DBInstanceIdentifier: !Join ["", [!Ref DocDBClusterIdentifier, "2"]]
DocDBDBInstance3:
Type: AWS::DocDB::DBInstance
DependsOn: DocumentDBCluster
Properties:
DBClusterIdentifier: !Ref DocumentDBCluster
DBInstanceClass: !Ref DocDBInstanceType
DBInstanceIdentifier: !Join ["", [!Ref DocDBClusterIdentifier, "3"]]
#outputs
Outputs:
ClusterId:
Value: !Ref DocumentDBCluster
PrimaryClusterEndpoint:
Value: !GetAtt DocumentDBCluster.Endpoint
ClusterPort:
Value: !GetAtt DocumentDBCluster.Port
DocDBUser:
Value: !Ref DocDBUsername
DocDBSgId:
Value: !Join [', ', !Ref DocDBSecurityGroup]