Skip to content

create_db_cluster_snapshot

create_db_cluster_snapshot(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_cluster_snapshot_identifier: Optional[String] = None,
    db_cluster_identifier: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> CreateDBClusterSnapshotResult

Creates a snapshot of a DB cluster.

For more information on Amazon Aurora, see What is Amazon Aurora? in the Amazon Aurora User Guide.

For more information on Multi-AZ DB clusters, see Multi-AZ DB cluster deployments in the Amazon RDS User Guide.

Parameters:

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

    The identifier of the DB cluster snapshot. This parameter is stored as a lowercase string.

    Constraints:

    • Must contain from 1 to 63 letters, numbers, or hyphens.

    • First character must be a letter.

    • Can't end with a hyphen or contain two consecutive hyphens.

    Example: my-cluster1-snapshot1

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

    The identifier of the DB cluster to create a snapshot for. This parameter isn't case-sensitive.

    Constraints:

    • Must match the identifier of an existing DBCluster.

    Example: my-cluster1

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

    The tags to be assigned to the DB cluster snapshot.

Raises:

Examples:

To create a DB cluster snapshot The following example creates a DB cluster snapshot.

>>> client.create_db_cluster_snapshot(db_cluster_snapshot_identifier='mydbcluster', db_cluster_identifier='mydbclustersnapshot')
Source code in docs_src/capo_rds/_services/rds.py
def create_db_cluster_snapshot(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_cluster_snapshot_identifier: Optional["capo_rds.types.string.String"] = None,
    db_cluster_identifier: Optional["capo_rds.types.string.String"] = None,
    tags: Optional["capo_rds.types.tag_list.TagList"] = None,
) -> (
    "capo_rds.types.create_db_cluster_snapshot_result.CreateDBClusterSnapshotResult"
):
    """<p>Creates a snapshot of a DB cluster.</p> <p>For more information on Amazon Aurora, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_AuroraOverview.html"> What is Amazon Aurora?</a> in the <i>Amazon Aurora User Guide</i>.</p> <p>For more information on Multi-AZ DB clusters, see <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.html"> Multi-AZ DB cluster deployments</a> in the <i>Amazon RDS User Guide</i>.</p>

    Args:
        db_cluster_snapshot_identifier: <p>The identifier of the DB cluster snapshot. This parameter is stored as a lowercase string.</p> <p>Constraints:</p> <ul> <li> <p>Must contain from 1 to 63 letters, numbers, or hyphens.</p> </li> <li> <p>First character must be a letter.</p> </li> <li> <p>Can't end with a hyphen or contain two consecutive hyphens.</p> </li> </ul> <p>Example: <code>my-cluster1-snapshot1</code> </p>
        db_cluster_identifier: <p>The identifier of the DB cluster to create a snapshot for. This parameter isn't case-sensitive.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing DBCluster.</p> </li> </ul> <p>Example: <code>my-cluster1</code> </p>
        tags: <p>The tags to be assigned to the DB cluster snapshot.</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.db_cluster_snapshot_already_exists_fault.DBClusterSnapshotAlreadyExistsFault: <p>The user already has a DB cluster snapshot with the given identifier.</p>
        capo_rds.errors.invalid_db_cluster_snapshot_state_fault.InvalidDBClusterSnapshotStateFault: <p>The supplied value isn't a valid DB cluster snapshot state.</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.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of DB snapshots.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a DB cluster snapshot
        The following example creates a DB cluster snapshot.

        >>> client.create_db_cluster_snapshot(db_cluster_snapshot_identifier='mydbcluster', db_cluster_identifier='mydbclustersnapshot')
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.create_db_cluster_snapshot_message.CreateDBClusterSnapshotMessage]",
    ) -> OperationResponse[
        "capo_rds.types.create_db_cluster_snapshot_result.CreateDBClusterSnapshotResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.create_db_cluster_snapshot

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDBClusterSnapshot")
    )
    input_: capo_rds.types.create_db_cluster_snapshot_message.CreateDBClusterSnapshotMessage = {}
    if db_cluster_snapshot_identifier is not None:
        input_["db_cluster_snapshot_identifier"] = db_cluster_snapshot_identifier
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier
    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