Skip to content

create_global_cluster async

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

Creates an Amazon DocumentDB global cluster that can span multiple multiple Amazon Web Services Regions. The global cluster contains one primary cluster with read-write capability, and up-to 10 read-only secondary clusters. Global clusters uses storage-based fast replication across regions with latencies less than one second, using dedicated infrastructure with no impact to your workload’s performance.

You can create a global cluster that is initially empty, and then add a primary and a secondary to it. Or you can specify an existing cluster during the create operation, and this cluster becomes the primary of the global cluster.

This action only applies to Amazon DocumentDB clusters.

Parameters:

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

    The cluster identifier of the new global cluster.

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

    The Amazon Resource Name (ARN) to use as the primary cluster of the global cluster. This parameter is optional.

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

    The name of the database engine to be used for this cluster.

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

    The engine version of the global cluster.

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

    The deletion protection setting for the new global cluster. The global cluster can't be deleted when deletion protection is enabled.

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

    The name for your database of up to 64 alpha-numeric characters. If you do not provide a name, Amazon DocumentDB will not create a database in the global cluster you are creating.

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

    The storage encryption setting for the new global cluster.

Raises:

Source code in docs_src/capo_docdb/_services/async_doc_db.py
async def create_global_cluster(
    self,
    *,
    config_overrides: Optional[AsyncDocDBClientConfig] = None,
    global_cluster_identifier: Optional[
        "capo_docdb.types.global_cluster_identifier.GlobalClusterIdentifier"
    ] = None,
    source_db_cluster_identifier: Optional["capo_docdb.types.string.String"] = None,
    engine: Optional["capo_docdb.types.string.String"] = None,
    engine_version: Optional["capo_docdb.types.string.String"] = None,
    deletion_protection: Optional[
        "capo_docdb.types.boolean_optional.BooleanOptional"
    ] = None,
    database_name: Optional["capo_docdb.types.string.String"] = None,
    storage_encrypted: Optional[
        "capo_docdb.types.boolean_optional.BooleanOptional"
    ] = None,
) -> "capo_docdb.types.create_global_cluster_result.CreateGlobalClusterResult":
    """<p>Creates an Amazon DocumentDB global cluster that can span multiple multiple Amazon Web Services Regions. The global cluster contains one primary cluster with read-write capability, and up-to 10 read-only secondary clusters. Global clusters uses storage-based fast replication across regions with latencies less than one second, using dedicated infrastructure with no impact to your workload’s performance.</p> <p></p> <p>You can create a global cluster that is initially empty, and then add a primary and a secondary to it. Or you can specify an existing cluster during the create operation, and this cluster becomes the primary of the global cluster. </p> <note> <p>This action only applies to Amazon DocumentDB clusters.</p> </note>

    Args:
        global_cluster_identifier: <p>The cluster identifier of the new global cluster.</p>
        source_db_cluster_identifier: <p>The Amazon Resource Name (ARN) to use as the primary cluster of the global cluster. This parameter is optional.</p>
        engine: <p>The name of the database engine to be used for this cluster.</p>
        engine_version: <p>The engine version of the global cluster.</p>
        deletion_protection: <p>The deletion protection setting for the new global cluster. The global cluster can't be deleted when deletion protection is enabled. </p>
        database_name: <p>The name for your database of up to 64 alpha-numeric characters. If you do not provide a name, Amazon DocumentDB will not create a database in the global cluster you are creating.</p>
        storage_encrypted: <p>The storage encryption setting for the new global cluster. </p>

    Raises:
        capo_docdb.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <code>DBClusterIdentifier</code> doesn't refer to an existing cluster. </p>
        capo_docdb.errors.global_cluster_already_exists_fault.GlobalClusterAlreadyExistsFault: <p>The <code>GlobalClusterIdentifier</code> already exists. Choose a new global cluster identifier (unique name) to create a new global cluster. </p>
        capo_docdb.errors.global_cluster_quota_exceeded_fault.GlobalClusterQuotaExceededFault: <p>The number of global clusters for this account is already at the maximum allowed.</p>
        capo_docdb.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The cluster isn't in a valid state.</p>
        capo_docdb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_docdb.types.create_global_cluster_message.CreateGlobalClusterMessage]",
    ) -> AsyncOperationResponse[
        "capo_docdb.types.create_global_cluster_result.CreateGlobalClusterResult"
    ]:
        import capo_docdb._operations.amazon_rd_sv19.create_global_cluster

        (
            output,
            http_response,
        ) = await capo_docdb._operations.amazon_rd_sv19.create_global_cluster.async_create_global_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGlobalCluster")
    )
    input_: capo_docdb.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 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

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output