Created
January 18, 2019 04:44
-
-
Save BigAl/666e7ad363c9527b12164c71aae49877 to your computer and use it in GitHub Desktop.
AWS RDS Read Replica
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Metadata: | |
License: Apache-2.0 | |
Description: 'Create Read Replica from the supplied MasterDBName' | |
Parameters: | |
MasterDBName: | |
Default: prod-9-6 | |
Description: The database name or the MasterDB | |
Type: String | |
MinLength: '1' | |
MaxLength: '64' | |
DBInstanceClass: | |
Description: The database instance type | |
Type: String | |
Default: db.t2.small | |
AllowedValues: [db.t1.micro, db.m1.small, db.m1.medium, db.m1.large, db.m1.xlarge, | |
db.m2.xlarge, db.m2.2xlarge, db.m2.4xlarge, db.m3.medium, db.m3.large, db.m3.xlarge, | |
db.m3.2xlarge, db.m4.large, db.m4.xlarge, db.m4.2xlarge, db.m4.4xlarge, db.m4.10xlarge, | |
db.r3.large, db.r3.xlarge, db.r3.2xlarge, db.r3.4xlarge, db.r3.8xlarge, db.m2.xlarge, | |
db.m2.2xlarge, db.m2.4xlarge, db.cr1.8xlarge, db.t2.micro, db.t2.small, db.t2.medium, | |
db.t2.large] | |
ConstraintDescription: must select a valid database instance type. | |
EC2SecurityGroup: | |
Description: The EC2 security group that contains instances that need access to | |
the database | |
Default: default | |
Type: String | |
AllowedPattern: '[a-zA-Z0-9\-]+' | |
ConstraintDescription: must be a valid security group name. | |
MultiAZ: | |
Description: Multi-AZ master database | |
Type: String | |
Default: 'false' | |
AllowedValues: ['true', 'false'] | |
ConstraintDescription: must be true or false. | |
Resources: | |
ReplicaDB: | |
Type: AWS::RDS::DBInstance | |
Properties: | |
SourceDBInstanceIdentifier: !Ref 'MasterDBName' | |
DBInstanceClass: !Ref 'DBInstanceClass' | |
Tags: | |
- Key: Name | |
Value: Read Replica Database | |
Outputs: | |
ReplicaJDBCConnectionString: | |
Description: JDBC connection string for the replica database | |
Value: !Join ['', ['jdbc:mysql://', !GetAtt [ReplicaDB, Endpoint.Address], ':', | |
!GetAtt [ReplicaDB, Endpoint.Port], /, !Ref 'MasterDBName']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment