Skip to content

copy_db_cluster_snapshot async

copy_db_cluster_snapshot(
    *,
    config_overrides: Optional[AsyncNeptuneClientConfig] = None,
    source_db_cluster_snapshot_identifier: Optional[String] = None,
    target_db_cluster_snapshot_identifier: Optional[String] = None,
    kms_key_id: Optional[String] = None,
    pre_signed_url: Optional[String] = None,
    copy_tags: Optional[BooleanOptional] = None,
    tags: Optional[TagList] = None,
) -> CopyDBClusterSnapshotResult

Copies a snapshot of a DB cluster.

To copy a DB cluster snapshot from a shared manual DB cluster snapshot, SourceDBClusterSnapshotIdentifier must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot.

Parameters:

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

    The identifier of the DB cluster snapshot to copy. This parameter is not case-sensitive. If the source DB cluster snapshot is in a different region or owned by another account, specify the snapshot ARN.

    Constraints:

    • Must specify a valid system snapshot in the "available" state.

    • Specify a valid DB snapshot identifier.

    Example: my-cluster-snapshot1

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

    The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This parameter is not case-sensitive.

    Constraints:

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

    • First character must be a letter.

    • Cannot end with a hyphen or contain two consecutive hyphens.

    Example: my-cluster-snapshot2

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

    The Amazon KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.

    If you copy an encrypted DB cluster snapshot from your Amazon account, you can specify a value for KmsKeyId to encrypt the copy with a new KMS encryption key. If you don't specify a value for KmsKeyId, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the source DB cluster snapshot.

    If you copy an encrypted DB cluster snapshot that is shared from another Amazon account, then you must specify a value for KmsKeyId.

    KMS encryption keys are specific to the Amazon Region that they are created in, and you can't use encryption keys from one Amazon Region in another Amazon Region.

    You cannot encrypt an unencrypted DB cluster snapshot when you copy it. If you try to copy an unencrypted DB cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.

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

    Not currently supported.

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

    True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot, and otherwise false. The default is false.

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

    The tags to assign to the new DB cluster snapshot copy.

Raises:

Source code in docs_src/capo_neptune/_services/async_neptune.py
async def copy_db_cluster_snapshot(
    self,
    *,
    config_overrides: Optional[AsyncNeptuneClientConfig] = None,
    source_db_cluster_snapshot_identifier: Optional[
        "capo_neptune.types.string.String"
    ] = None,
    target_db_cluster_snapshot_identifier: Optional[
        "capo_neptune.types.string.String"
    ] = None,
    kms_key_id: Optional["capo_neptune.types.string.String"] = None,
    pre_signed_url: Optional["capo_neptune.types.string.String"] = None,
    copy_tags: Optional[
        "capo_neptune.types.boolean_optional.BooleanOptional"
    ] = None,
    tags: Optional["capo_neptune.types.tag_list.TagList"] = None,
) -> (
    "capo_neptune.types.copy_db_cluster_snapshot_result.CopyDBClusterSnapshotResult"
):
    """<p>Copies a snapshot of a DB cluster.</p> <p>To copy a DB cluster snapshot from a shared manual DB cluster snapshot, <code>SourceDBClusterSnapshotIdentifier</code> must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot.</p>

    Args:
        source_db_cluster_snapshot_identifier: <p>The identifier of the DB cluster snapshot to copy. This parameter is not case-sensitive. If the source DB cluster snapshot is in a different region or owned by another account, specify the snapshot ARN.</p> <p>Constraints:</p> <ul> <li> <p>Must specify a valid system snapshot in the "available" state.</p> </li> <li> <p>Specify a valid DB snapshot identifier.</p> </li> </ul> <p>Example: <code>my-cluster-snapshot1</code> </p>
        target_db_cluster_snapshot_identifier: <p>The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This parameter is not case-sensitive.</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>Cannot end with a hyphen or contain two consecutive hyphens.</p> </li> </ul> <p>Example: <code>my-cluster-snapshot2</code> </p>
        kms_key_id: <p>The Amazon KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.</p> <p>If you copy an encrypted DB cluster snapshot from your Amazon account, you can specify a value for <code>KmsKeyId</code> to encrypt the copy with a new KMS encryption key. If you don't specify a value for <code>KmsKeyId</code>, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the source DB cluster snapshot.</p> <p>If you copy an encrypted DB cluster snapshot that is shared from another Amazon account, then you must specify a value for <code>KmsKeyId</code>.</p> <p> KMS encryption keys are specific to the Amazon Region that they are created in, and you can't use encryption keys from one Amazon Region in another Amazon Region.</p> <p>You cannot encrypt an unencrypted DB cluster snapshot when you copy it. If you try to copy an unencrypted DB cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.</p>
        pre_signed_url: <p>Not currently supported.</p>
        copy_tags: <p>True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot, and otherwise false. The default is false.</p>
        tags: <p>The tags to assign to the new DB cluster snapshot copy.</p>

    Raises:
        capo_neptune.errors.db_cluster_snapshot_already_exists_fault.DBClusterSnapshotAlreadyExistsFault: <p>User already has a DB cluster snapshot with the given identifier.</p>
        capo_neptune.errors.db_cluster_snapshot_not_found_fault.DBClusterSnapshotNotFoundFault: <p> <i>DBClusterSnapshotIdentifier</i> does not refer to an existing DB cluster snapshot.</p>
        capo_neptune.errors.invalid_db_cluster_snapshot_state_fault.InvalidDBClusterSnapshotStateFault: <p>The supplied value is not a valid DB cluster snapshot state.</p>
        capo_neptune.errors.invalid_db_cluster_state_fault.InvalidDBClusterStateFault: <p>The DB cluster is not in a valid state.</p>
        capo_neptune.errors.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>Error accessing KMS key.</p>
        capo_neptune.errors.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>Request would result in user exceeding the allowed number of DB snapshots.</p>
        capo_neptune.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_neptune.types.copy_db_cluster_snapshot_message.CopyDBClusterSnapshotMessage]",
    ) -> AsyncOperationResponse[
        "capo_neptune.types.copy_db_cluster_snapshot_result.CopyDBClusterSnapshotResult"
    ]:
        import capo_neptune._operations.amazon_rd_sv19.copy_db_cluster_snapshot

        (
            output,
            http_response,
        ) = await capo_neptune._operations.amazon_rd_sv19.copy_db_cluster_snapshot.async_copy_db_cluster_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyDBClusterSnapshot")
    )
    input_: capo_neptune.types.copy_db_cluster_snapshot_message.CopyDBClusterSnapshotMessage = {}
    if source_db_cluster_snapshot_identifier is not None:
        input_["source_db_cluster_snapshot_identifier"] = (
            source_db_cluster_snapshot_identifier
        )
    if target_db_cluster_snapshot_identifier is not None:
        input_["target_db_cluster_snapshot_identifier"] = (
            target_db_cluster_snapshot_identifier
        )
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if pre_signed_url is not None:
        input_["pre_signed_url"] = pre_signed_url
    if copy_tags is not None:
        input_["copy_tags"] = copy_tags
    if tags is not None:
        input_["tags"] = tags

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