Skip to content

stop_db_cluster async

stop_db_cluster(
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_identifier: Optional[String] = None,
) -> StopDBClusterResult

Stops an Amazon Aurora DB cluster. When you stop a DB cluster, Aurora retains the DB cluster's metadata, including its endpoints and DB parameter groups. Aurora also retains the transaction logs so you can do a point-in-time restore if necessary.

For more information, see Stopping and Starting an Aurora Cluster in the Amazon Aurora User Guide.

This operation only applies to Aurora DB clusters.

Parameters:

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

    The DB cluster identifier of the Amazon Aurora DB cluster to be stopped. This parameter is stored as a lowercase string.

Raises:

Examples:

To stop a DB cluster The following example stops a DB cluster and its DB instances.

>>> await client.stop_db_cluster(db_cluster_identifier='mydbcluster')
Source code in docs_src/capo_rds/_services/async_rds.py
async def stop_db_cluster(
    self,
    *,
    config_overrides: Optional[AsyncRDSClientConfig] = None,
    db_cluster_identifier: Optional["capo_rds.types.string.String"] = None,
) -> "capo_rds.types.stop_db_cluster_result.StopDBClusterResult":
    """<p>Stops an Amazon Aurora DB cluster. When you stop a DB cluster, Aurora retains the DB cluster's metadata, including its endpoints and DB parameter groups. Aurora also retains the transaction logs so you can do a point-in-time restore if necessary.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-cluster-stop-start.html"> Stopping and Starting an Aurora Cluster</a> in the <i>Amazon Aurora User Guide</i>.</p> <note> <p>This operation only applies to Aurora DB clusters.</p> </note>

    Args:
        db_cluster_identifier: <p>The DB cluster identifier of the Amazon Aurora DB cluster to be stopped. This parameter is stored as a lowercase string.</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.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_instance_state_fault.InvalidDBInstanceStateFault: <p>The DB instance isn't in a valid 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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To stop a DB cluster
        The following example stops a DB cluster and its DB instances.

        >>> await client.stop_db_cluster(db_cluster_identifier='mydbcluster')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_rds.types.stop_db_cluster_message.StopDBClusterMessage]",
    ) -> AsyncOperationResponse[
        "capo_rds.types.stop_db_cluster_result.StopDBClusterResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.stop_db_cluster

        (
            output,
            http_response,
        ) = await capo_rds._operations.amazon_rd_sv19.stop_db_cluster.async_stop_db_cluster(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_rds.types.stop_db_cluster_result.StopDBClusterResult",
    ) -> dict[str, Any]:
        import capo_rds.types.stop_db_cluster_result

        return capo_rds.types.stop_db_cluster_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StopDBCluster", redact_output=_redact_output),
    )
    input_: capo_rds.types.stop_db_cluster_message.StopDBClusterMessage = {}
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier

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