AWS::RDS::GlobalCluster
The AWS::RDS::GlobalCluster
resource creates or updates an Amazon Aurora global database
spread across multiple AWS Regions.
The global database contains a single primary cluster with read-write capability, and a read-only secondary cluster that receives data from the primary cluster through high-speed replication performed by the Aurora storage subsystem.
You can create a global database that is initially empty, and then add a primary cluster and a secondary cluster to it.
For information about Aurora global databases, see Working with Amazon Aurora Global Databases in the Amazon Aurora User Guide.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::RDS::GlobalCluster", "Properties" : { "DeletionProtection" :
Boolean
, "Engine" :String
, "EngineVersion" :String
, "GlobalClusterIdentifier" :String
, "SourceDBClusterIdentifier" :String
, "StorageEncrypted" :Boolean
} }
YAML
Type: AWS::RDS::GlobalCluster Properties: DeletionProtection:
Boolean
Engine:String
EngineVersion:String
GlobalClusterIdentifier:String
SourceDBClusterIdentifier:String
StorageEncrypted:Boolean
Properties
DeletionProtection
-
The deletion protection setting for the new global database. The global database can't be deleted when deletion protection is enabled.
Required: No
Type: Boolean
Update requires: No interruption
Engine
-
The name of the database engine to be used for this DB cluster.
If this property isn't specified, the database engine is derived from the source DB cluster specified by the
SourceDBClusterIdentifier
property.Note If the
SourceDBClusterIdentifier
property isn't specified, this property is required. If theSourceDBClusterIdentifier
property is specified, make sure this property isn't specified.Required: Conditional
Type: String
Update requires: Replacement
EngineVersion
-
The engine version of the Aurora global database.
Required: No
Type: String
Update requires: Replacement
GlobalClusterIdentifier
-
The cluster identifier of the global database cluster.
Required: Conditional
Type: String
Update requires: Replacement
SourceDBClusterIdentifier
-
The DB cluster identifier or Amazon Resource Name (ARN) to use as the primary cluster of the global database.
Note If the
Engine
property isn't specified, this property is required. If theEngine
property is specified, make sure this property isn't specified.Required: Conditional
Type: String
Update requires: Replacement
StorageEncrypted
-
The storage encryption setting for the global database cluster.
Required: No
Type: Boolean
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the name of the global database cluster.
For more information about using the Ref
function, see Ref.
Examples
Creating a Global Database cluster for Aurora MySQL
The following example creates a global database cluster with an Aurora MySQL DB cluster and DB instance.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "GlobalClusterIdentifier": { "Type": "String", "Description": "Identifier used for global database cluster", "AllowedPattern": "^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$" }, "username": { "NoEcho": "true", "Description": "Username for MySQL database access", "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." }, "password": { "NoEcho": "true", "Description": "Password for MySQL database access", "Type": "String", "MinLength": "8", "MaxLength": "41", "AllowedPattern": "[a-zA-Z0-9]*", "ConstraintDescription": "must contain only alphanumeric characters." } }, "Resources": { "GlobalCluster": { "Type": "AWS::RDS::GlobalCluster", "Properties": { "GlobalClusterIdentifier": { "Ref": "GlobalClusterIdentifier" }, "SourceDBClusterIdentifier": { "Ref": "RDSCluster" } } }, "RDSCluster": { "Type": "AWS::RDS::DBCluster", "Properties": { "MasterUsername": { "Ref": "username" }, "MasterUserPassword": { "Ref": "password" }, "DBClusterParameterGroupName": "default.aurora-mysql5.7", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.10.0" } }, "RDSDBInstance": { "Type": "AWS::RDS::DBInstance", "Properties": { "Engine": "aurora-mysql", "DBClusterIdentifier": { "Ref": "RDSCluster" }, "DBParameterGroupName": "default.aurora-mysql5.7", "PubliclyAccessible": "true", "DBInstanceClass": "db.r5.xlarge" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Parameters: GlobalClusterIdentifier: Type: String Description: Identifier used for global database cluster AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$' username: NoEcho: 'true' Description: Username for MySQL database access 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. password: NoEcho: 'true' Description: Password for MySQL database access Type: String MinLength: '8' MaxLength: '41' AllowedPattern: '[a-zA-Z0-9]*' ConstraintDescription: must contain only alphanumeric characters. Resources: GlobalCluster: Type: 'AWS::RDS::GlobalCluster' Properties: GlobalClusterIdentifier: !Ref GlobalClusterIdentifier SourceDBClusterIdentifier: !Ref RDSCluster RDSCluster: Type: 'AWS::RDS::DBCluster' Properties: MasterUsername: !Ref username MasterUserPassword: !Ref password DBClusterParameterGroupName: default.aurora-mysql5.7 Engine: aurora-mysql EngineVersion: 5.7.mysql_aurora.2.10.0 RDSDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-mysql DBClusterIdentifier: !Ref RDSCluster DBParameterGroupName: default.aurora-mysql5.7 PubliclyAccessible: 'true' DBInstanceClass: db.r5.xlarge
Creating a Global Database cluster for Aurora PostgreSQL
The following example creates a global database cluster with an Aurora PostgreSQL DB cluster and DB instance.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "GlobalClusterIdentifier": { "Type": "String", "Description": "Identifier used for global database cluster", "AllowedPattern": "^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$" }, "username": { "NoEcho": "true", "Description": "Username for PostgreSQL database access", "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." }, "password": { "NoEcho": "true", "Description": "Password for PostgreSQL database access", "Type": "String", "MinLength": "8", "MaxLength": "41", "AllowedPattern": "[a-zA-Z0-9]*", "ConstraintDescription": "must contain only alphanumeric characters." } }, "Resources": { "GlobalCluster": { "Type": "AWS::RDS::GlobalCluster", "Properties": { "GlobalClusterIdentifier": { "Ref": "GlobalClusterIdentifier" }, "SourceDBClusterIdentifier": { "Ref": "RDSCluster" } } }, "RDSCluster": { "Type": "AWS::RDS::DBCluster", "Properties": { "MasterUsername": { "Ref": "username" }, "MasterUserPassword": { "Ref": "password" }, "DBClusterParameterGroupName": "default.aurora-postgresql11", "Engine": "aurora-postgresql", "EngineVersion": "11.7" } }, "RDSDBInstance": { "Type": "AWS::RDS::DBInstance", "Properties": { "Engine": "aurora-postgresql", "DBClusterIdentifier": { "Ref": "RDSCluster" }, "DBParameterGroupName": "default.aurora-postgresql11", "PubliclyAccessible": "true", "DBInstanceClass": "db.r5.xlarge" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Parameters: GlobalClusterIdentifier: Type: String Description: Identifier used for global database cluster AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$' username: NoEcho: 'true' Description: Username for PostgreSQL database access 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. password: NoEcho: 'true' Description: Password for PostgreSQL database access Type: String MinLength: '8' MaxLength: '41' AllowedPattern: '[a-zA-Z0-9]*' ConstraintDescription: must contain only alphanumeric characters. Resources: GlobalCluster: Type: 'AWS::RDS::GlobalCluster' Properties: GlobalClusterIdentifier: !Ref GlobalClusterIdentifier SourceDBClusterIdentifier: !Ref RDSCluster RDSCluster: Type: 'AWS::RDS::DBCluster' Properties: MasterUsername: !Ref username MasterUserPassword: !Ref password DBClusterParameterGroupName: default.aurora-postgresql11 Engine: aurora-postgresql EngineVersion: '11.7' RDSDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-postgresql DBClusterIdentifier: !Ref RDSCluster DBParameterGroupName: default.aurora-postgresql11 PubliclyAccessible: 'true' DBInstanceClass: db.r5.xlarge
Adding a Region to an Aurora database cluster
The following example creates a new Aurora DB cluster, attaches it to a global database cluster as a read-only secondary cluster, and then adds a DB instance to the new DB cluster.
Specify the GlobalClusterIdentifier
of a global database cluster with the primary DB cluster in a separate AWS Region.
JSON
{ "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "GlobalClusterIdentifier": { "Type": "String", "Description": "Identifier used for global database cluster", "AllowedPattern": "^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$" } }, "Resources": { "RDSCluster": { "Type": "AWS::RDS::DBCluster", "Properties": { "GlobalClusterIdentifier": { "Ref": "GlobalClusterIdentifier" }, "DBClusterParameterGroupName": "default.aurora-mysql5.7", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.10.0" } }, "RDSDBInstance": { "Type": "AWS::RDS::DBInstance", "Properties": { "Engine": "aurora-mysql", "DBClusterIdentifier": { "Ref": "RDSCluster" }, "DBParameterGroupName": "default.aurora-mysql5.7", "PubliclyAccessible": "true", "DBInstanceClass": "db.r5.xlarge" } } } }
YAML
AWSTemplateFormatVersion: 2010-09-09 Parameters: GlobalClusterIdentifier: Type: String Description: Identifier used for global database cluster AllowedPattern: '^[a-zA-Z]{1}(?:-?[a-zA-Z0-9]){0,62}$' Resources: RDSCluster: Type: 'AWS::RDS::DBCluster' Properties: GlobalClusterIdentifier: !Ref GlobalClusterIdentifier DBClusterParameterGroupName: default.aurora-mysql5.7 Engine: aurora-mysql EngineVersion: 5.7.mysql_aurora.2.10.0 RDSDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-mysql DBClusterIdentifier: !Ref RDSCluster DBParameterGroupName: default.aurora-mysql5.7 PubliclyAccessible: 'true' DBInstanceClass: db.r5.xlarge
Adding a DB cluster to a Global Database cluster
The following example adds a DB cluster to a global database cluster.
The example includes the template that was used to create the DB cluster. After the DB cluster created by the first template exists, the second template in the example adds the DB cluster to a global database cluster.
JSON
The following template was used to create DB cluster that you want to add to the global database cluster. { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "username": { "NoEcho": "true", "Description": "Username for MySQL database access", "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." }, "password": { "NoEcho": "true", "Description": "Password MySQL database access", "Type": "String", "MinLength": "8", "MaxLength": "41", "AllowedPattern": "[a-zA-Z0-9]*", "ConstraintDescription": "must contain only alphanumeric characters." } }, "Resources": { "RDSCluster": { "Type": "AWS::RDS::DBCluster", "Properties": { "MasterUsername": { "Ref": "username" }, "MasterUserPassword": { "Ref": "password" }, "DBClusterParameterGroupName": "default.aurora-mysql5.7", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.10.0" } }, "RDSDBInstance": { "Type": "AWS::RDS::DBInstance", "Properties": { "Engine": "aurora-mysql", "DBClusterIdentifier": { "Ref": "RDSCluster" }, "DBParameterGroupName": "default.aurora-mysql5.7", "PubliclyAccessible": "true", "DBInstanceClass": "db.r5.xlarge" } } } } The following template adds the DB cluster created by the previous template to a global database cluster. { "AWSTemplateFormatVersion": "2010-09-09", "Parameters": { "GlobalClusterIdentifier": { "Description": "Global cluster identifier", "Type": "String" }, "username": { "NoEcho": "true", "Description": "Username for MySQL database access", "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." }, "password": { "NoEcho": "true", "Description": "Password MySQL database access", "Type": "String", "MinLength": "8", "MaxLength": "41", "AllowedPattern": "[a-zA-Z0-9]*", "ConstraintDescription": "must contain only alphanumeric characters." } }, "Resources": { "GlobalCluster": { "Type": "AWS::RDS::GlobalCluster", "Properties": { "GlobalClusterIdentifier": { "Ref": "GlobalClusterIdentifier" }, "SourceDBClusterIdentifier": { "Ref": "RDSCluster" } } }, "RDSCluster": { "Type": "AWS::RDS::DBCluster", "Properties": { "MasterUsername": { "Ref": "username" }, "MasterUserPassword": { "Ref": "password" }, "DBClusterParameterGroupName": "default.aurora-mysql5.7", "Engine": "aurora-mysql", "EngineVersion": "5.7.mysql_aurora.2.10.0" } }, "RDSDBInstance": { "Type": "AWS::RDS::DBInstance", "Properties": { "Engine": "aurora-mysql", "DBClusterIdentifier": { "Ref": "RDSCluster" }, "DBParameterGroupName": "default.aurora-mysql5.7", "PubliclyAccessible": "true", "DBInstanceClass": "db.r5.xlarge" } } } }
YAML
The following template created the DB cluster that you want to add to the global database cluster. AWSTemplateFormatVersion: 2010-09-09 Parameters: username: NoEcho: 'true' Description: Username for MySQL database access 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. password: NoEcho: 'true' Description: Password MySQL database access Type: String MinLength: '8' MaxLength: '41' AllowedPattern: '[a-zA-Z0-9]*' ConstraintDescription: must contain only alphanumeric characters. Resources: RDSCluster: Type: 'AWS::RDS::DBCluster' Properties: MasterUsername: !Ref username MasterUserPassword: !Ref password DBClusterParameterGroupName: default.aurora-mysql5.7 Engine: aurora-mysql EngineVersion: 5.7.mysql_aurora.2.10.0 RDSDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-mysql DBClusterIdentifier: !Ref RDSCluster DBParameterGroupName: default.aurora-mysql5.7 PubliclyAccessible: 'true' DBInstanceClass: db.r5.xlarge The following template adds the DB cluster created by the previous template to a global database cluster. AWSTemplateFormatVersion: 2010-09-09 Parameters: GlobalClusterIdentifier: Description: Global cluster identifier Type: String username: NoEcho: 'true' Description: Username for MySQL database access 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. password: NoEcho: 'true' Description: Password MySQL database access Type: String MinLength: '8' MaxLength: '41' AllowedPattern: '[a-zA-Z0-9]*' ConstraintDescription: must contain only alphanumeric characters. Resources: GlobalCluster: Type: 'AWS::RDS::GlobalCluster' Properties: GlobalClusterIdentifier: !Ref GlobalClusterIdentifier SourceDBClusterIdentifier: !Ref RDSCluster RDSCluster: Type: 'AWS::RDS::DBCluster' Properties: MasterUsername: !Ref username MasterUserPassword: !Ref password DBClusterParameterGroupName: default.aurora-mysql5.7 Engine: aurora-mysql EngineVersion: 5.7.mysql_aurora.2.10.0 RDSDBInstance: Type: 'AWS::RDS::DBInstance' Properties: Engine: aurora-mysql DBClusterIdentifier: !Ref RDSCluster DBParameterGroupName: default.aurora-mysql5.7 PubliclyAccessible: 'true' DBInstanceClass: db.r5.xlarge