createGlobalCluster method

Future<CreateGlobalClusterResult> createGlobalCluster({
  1. required String globalClusterIdentifier,
  2. String? databaseName,
  3. bool? deletionProtection,
  4. String? engine,
  5. String? engineLifecycleSupport,
  6. String? engineVersion,
  7. String? sourceDBClusterIdentifier,
  8. bool? storageEncrypted,
  9. List<Tag>? tags,
})

Creates an Aurora global database spread across multiple Amazon Web Services 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 create the primary and secondary DB clusters in the global database. Or you can specify an existing Aurora cluster during the create operation, and this cluster becomes the primary cluster of the global database.

May throw DBClusterNotFoundFault. May throw GlobalClusterAlreadyExistsFault. May throw GlobalClusterQuotaExceededFault. May throw InvalidDBClusterStateFault. May throw InvalidDBShardGroupStateFault. May throw ResourceNotFoundFault.

Parameter globalClusterIdentifier : The cluster identifier for this global database cluster. This parameter is stored as a lowercase string.

Parameter databaseName : The name for your database of up to 64 alphanumeric characters. If you don't specify a name, Amazon Aurora doesn't create a database in the global database cluster.

Constraints:

  • Can't be specified if SourceDBClusterIdentifier is specified. In this case, Amazon Aurora uses the database name from the source DB cluster.

Parameter deletionProtection : Specifies whether to enable deletion protection for the new global database cluster. The global database can't be deleted when deletion protection is enabled.

Parameter engine : The database engine to use for this global database cluster.

Valid Values: aurora-mysql | aurora-postgresql

Constraints:

  • Can't be specified if SourceDBClusterIdentifier is specified. In this case, Amazon Aurora uses the engine of the source DB cluster.

Parameter engineLifecycleSupport : The life cycle type for this global database cluster. This setting only applies to Aurora PostgreSQL-based global databases.

You can use this setting to enroll your global cluster into Amazon RDS Extended Support. With RDS Extended Support, you can run the selected major engine version on your global cluster past the end of standard support for that engine version. For more information, see Amazon RDS Extended Support with Amazon Aurora in the Amazon Aurora User Guide.

Valid Values: open-source-rds-extended-support | open-source-rds-extended-support-disabled

Default: open-source-rds-extended-support

Parameter engineVersion : The engine version to use for this global database cluster.

Constraints:

  • Can't be specified if SourceDBClusterIdentifier is specified. In this case, Amazon Aurora uses the engine version of the source DB cluster.

Parameter sourceDBClusterIdentifier : The Amazon Resource Name (ARN) to use as the primary cluster of the global database.

If you provide a value for this parameter, don't specify values for the following settings because Amazon Aurora uses the values from the specified source DB cluster:

  • DatabaseName
  • Engine
  • EngineVersion
  • StorageEncrypted

Parameter storageEncrypted : Specifies whether to enable storage encryption for the new global database cluster.

Constraints:

  • Can't be specified if SourceDBClusterIdentifier is specified. In this case, Amazon Aurora uses the setting from the source DB cluster.

Parameter tags : Tags to assign to the global cluster.

Implementation

Future<CreateGlobalClusterResult> createGlobalCluster({
  required String globalClusterIdentifier,
  String? databaseName,
  bool? deletionProtection,
  String? engine,
  String? engineLifecycleSupport,
  String? engineVersion,
  String? sourceDBClusterIdentifier,
  bool? storageEncrypted,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'GlobalClusterIdentifier': globalClusterIdentifier,
    if (databaseName != null) 'DatabaseName': databaseName,
    if (deletionProtection != null)
      'DeletionProtection': deletionProtection.toString(),
    if (engine != null) 'Engine': engine,
    if (engineLifecycleSupport != null)
      'EngineLifecycleSupport': engineLifecycleSupport,
    if (engineVersion != null) 'EngineVersion': engineVersion,
    if (sourceDBClusterIdentifier != null)
      'SourceDBClusterIdentifier': sourceDBClusterIdentifier,
    if (storageEncrypted != null)
      'StorageEncrypted': storageEncrypted.toString(),
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateGlobalCluster',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateGlobalClusterResult',
  );
  return CreateGlobalClusterResult.fromXml($result);
}