Skip to content

create_global_cluster

create_global_cluster(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    global_cluster_identifier: Optional[GlobalClusterIdentifier] = None,
    source_db_cluster_identifier: Optional[String] = None,
    engine: Optional[String] = None,
    engine_version: Optional[String] = None,
    engine_lifecycle_support: Optional[String] = None,
    deletion_protection: Optional[BooleanOptional] = None,
    database_name: Optional[String] = None,
    storage_encrypted: Optional[BooleanOptional] = None,
    tags: Optional[TagList] = None,
) -> CreateGlobalClusterResult

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.

This operation applies only to Aurora DB clusters.

Parameters:

  • global_cluster_identifier (Optional[GlobalClusterIdentifier], default: None ) –

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

  • source_db_cluster_identifier (Optional[String], default: None ) –

    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

  • engine (Optional[String], default: None ) –

    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.

  • engine_version (Optional[String], default: None ) –

    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.

  • engine_lifecycle_support (Optional[String], default: None ) –

    The lifecycle type for this global database cluster.

    By default, this value is set to open-source-rds-extended-support, which enrolls your global cluster into Amazon RDS Extended Support. At the end of standard support, you can avoid charges for Extended Support by setting the value to open-source-rds-extended-support-disabled. In this case, creating the global cluster will fail if the DB major version is past its end of standard support date.

    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

  • deletion_protection (Optional[BooleanOptional], default: None ) –

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

  • database_name (Optional[String], default: None ) –

    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.

  • storage_encrypted (Optional[BooleanOptional], default: None ) –

    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.

  • tags (Optional[TagList], default: None ) –

    Tags to assign to the global cluster.

Raises:

Examples:

To create a global DB cluster The following example creates a new Aurora MySQL-compatible global DB cluster.

>>> client.create_global_cluster(global_cluster_identifier='myglobalcluster', engine='aurora-mysql')
Source code in docs_src/capo_rds/_services/rds.py
def create_global_cluster(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    global_cluster_identifier: Optional[
        "capo_rds.types.global_cluster_identifier.GlobalClusterIdentifier"
    ] = None,
    source_db_cluster_identifier: Optional["capo_rds.types.string.String"] = None,
    engine: Optional["capo_rds.types.string.String"] = None,
    engine_version: Optional["capo_rds.types.string.String"] = None,
    engine_lifecycle_support: Optional["capo_rds.types.string.String"] = None,
    deletion_protection: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    database_name: Optional["capo_rds.types.string.String"] = None,
    storage_encrypted: Optional[
        "capo_rds.types.boolean_optional.BooleanOptional"
    ] = None,
    tags: Optional["capo_rds.types.tag_list.TagList"] = None,
) -> "capo_rds.types.create_global_cluster_result.CreateGlobalClusterResult":
    """<p>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.</p> <p>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.</p> <note> <p>This operation applies only to Aurora DB clusters.</p> </note>

    Args:
        global_cluster_identifier: <p>The cluster identifier for this global database cluster. This parameter is stored as a lowercase string.</p>
        source_db_cluster_identifier: <p>The Amazon Resource Name (ARN) to use as the primary cluster of the global database.</p> <p>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:</p> <ul> <li> <p> <code>DatabaseName</code> </p> </li> <li> <p> <code>Engine</code> </p> </li> <li> <p> <code>EngineVersion</code> </p> </li> <li> <p> <code>StorageEncrypted</code> </p> </li> </ul>
        engine: <p>The database engine to use for this global database cluster.</p> <p>Valid Values: <code>aurora-mysql | aurora-postgresql</code> </p> <p>Constraints:</p> <ul> <li> <p>Can't be specified if <code>SourceDBClusterIdentifier</code> is specified. In this case, Amazon Aurora uses the engine of the source DB cluster.</p> </li> </ul>
        engine_version: <p>The engine version to use for this global database cluster.</p> <p>Constraints:</p> <ul> <li> <p>Can't be specified if <code>SourceDBClusterIdentifier</code> is specified. In this case, Amazon Aurora uses the engine version of the source DB cluster.</p> </li> </ul>
        engine_lifecycle_support: <p>The lifecycle type for this global database cluster.</p> <note> <p>By default, this value is set to <code>open-source-rds-extended-support</code>, which enrolls your global cluster into Amazon RDS Extended Support. At the end of standard support, you can avoid charges for Extended Support by setting the value to <code>open-source-rds-extended-support-disabled</code>. In this case, creating the global cluster will fail if the DB major version is past its end of standard support date.</p> </note> <p>This setting only applies to Aurora PostgreSQL-based global databases.</p> <p>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 <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/extended-support.html">Amazon RDS Extended Support with Amazon Aurora</a> in the <i>Amazon Aurora User Guide</i>.</p> <p>Valid Values: <code>open-source-rds-extended-support | open-source-rds-extended-support-disabled</code> </p> <p>Default: <code>open-source-rds-extended-support</code> </p>
        deletion_protection: <p>Specifies whether to enable deletion protection for the new global database cluster. The global database can't be deleted when deletion protection is enabled.</p>
        database_name: <p>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.</p> <p>Constraints:</p> <ul> <li> <p>Can't be specified if <code>SourceDBClusterIdentifier</code> is specified. In this case, Amazon Aurora uses the database name from the source DB cluster.</p> </li> </ul>
        storage_encrypted: <p>Specifies whether to enable storage encryption for the new global database cluster.</p> <p>Constraints:</p> <ul> <li> <p>Can't be specified if <code>SourceDBClusterIdentifier</code> is specified. In this case, Amazon Aurora uses the setting from the source DB cluster.</p> </li> </ul>
        tags: <p>Tags to assign to the global cluster.</p>

    Raises:
        capo_rds.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing DB cluster.</p>
        capo_rds.errors.global_cluster_already_exists_fault.GlobalClusterAlreadyExistsFault: <p>The <code>GlobalClusterIdentifier</code> already exists. Specify a new global database identifier (unique name) to create a new global database cluster or to rename an existing one.</p>
        capo_rds.errors.global_cluster_quota_exceeded_fault.GlobalClusterQuotaExceededFault: <p>The number of global database clusters for this account is already at the maximum allowed.</p>
        capo_rds.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The requested operation can't be performed while the cluster is in this state.</p>
        capo_rds.errors.invalid_db_shard_group_state_fault.InvalidDBShardGroupStateFault: <p>The DB shard group must be in the available state.</p>
        capo_rds.errors.resource_not_found_fault.ResourceNotFoundFault: <p>The specified resource ID was not found.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a global DB cluster
        The following example creates a new Aurora MySQL-compatible global DB cluster.

        >>> client.create_global_cluster(global_cluster_identifier='myglobalcluster', engine='aurora-mysql')
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.create_global_cluster_message.CreateGlobalClusterMessage]",
    ) -> OperationResponse[
        "capo_rds.types.create_global_cluster_result.CreateGlobalClusterResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.create_global_cluster

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.create_global_cluster.create_global_cluster(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGlobalCluster")
    )
    input_: capo_rds.types.create_global_cluster_message.CreateGlobalClusterMessage = {}
    if global_cluster_identifier is not None:
        input_["global_cluster_identifier"] = global_cluster_identifier
    if source_db_cluster_identifier is not None:
        input_["source_db_cluster_identifier"] = source_db_cluster_identifier
    if engine is not None:
        input_["engine"] = engine
    if engine_version is not None:
        input_["engine_version"] = engine_version
    if engine_lifecycle_support is not None:
        input_["engine_lifecycle_support"] = engine_lifecycle_support
    if deletion_protection is not None:
        input_["deletion_protection"] = deletion_protection
    if database_name is not None:
        input_["database_name"] = database_name
    if storage_encrypted is not None:
        input_["storage_encrypted"] = storage_encrypted
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output