Skip to content

copy_cluster_snapshot

copy_cluster_snapshot(
    snapshot_arn: str,
    target_snapshot_name: str,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    kms_key_id: Optional[str] = None,
    copy_tags: Optional[bool] = None,
    tags: Optional[TagMap] = None,
) -> CopyClusterSnapshotOutput

Copies a snapshot of an elastic cluster.

Parameters:

  • snapshot_arn (str) –

    The Amazon Resource Name (ARN) identifier of the elastic cluster snapshot.

  • target_snapshot_name (str) –

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

    Constraints:

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

    • The first character must be a letter.

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

    Example: elastic-cluster-snapshot-5

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

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

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

    To copy an encrypted elastic cluster snapshot to another Amazon Web Services region, set KmsKeyId to the Amazon Web Services KMS key ID that you want to use to encrypt the copy of the elastic cluster snapshot in the destination region. Amazon Web Services KMS encryption keys are specific to the Amazon Web Services region that they are created in, and you can't use encryption keys from one Amazon Web Services region in another Amazon Web Services region.

    If you copy an unencrypted elastic cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.

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

    Set to true to copy all tags from the source cluster snapshot to the target elastic cluster snapshot. The default is false.

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

    The tags to be assigned to the elastic cluster snapshot.

Raises:

Examples:

Basic Copy Cluster Snapshot Example update applied

>>> client.copy_cluster_snapshot(snapshot_arn='arn:aws:docdb-elastic:us-east-1:$AWS_ACCOUNT_ID:cluster-snapshot/$SOURCE_SNAPSHOT_ID', target_snapshot_name='sampleSnapshotName')
Source code in docs_src/capo_docdb_elastic/_services/doc_db_elastic.py
def copy_cluster_snapshot(
    self,
    snapshot_arn: str,
    target_snapshot_name: str,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    kms_key_id: Optional[str] = None,
    copy_tags: Optional[bool] = None,
    tags: Optional["capo_docdb_elastic.types.tag_map.TagMap"] = None,
) -> "capo_docdb_elastic.types.copy_cluster_snapshot_output.CopyClusterSnapshotOutput":
    """<p>Copies a snapshot of an elastic cluster.</p>

    Args:
        snapshot_arn: <p>The Amazon Resource Name (ARN) identifier of the elastic cluster snapshot.</p>
        target_snapshot_name: <p>The identifier of the new elastic cluster snapshot to create from the source 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>The 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>elastic-cluster-snapshot-5</code> </p>
        kms_key_id: <p>The Amazon Web Services KMS key ID for an encrypted elastic cluster snapshot. The Amazon Web Services KMS key ID is the Amazon Resource Name (ARN), Amazon Web Services KMS key identifier, or the Amazon Web Services KMS key alias for the Amazon Web Services KMS encryption key.</p> <p>If you copy an encrypted elastic cluster snapshot from your Amazon Web Services account, you can specify a value for <code>KmsKeyId</code> to encrypt the copy with a new Amazon Web ServicesS KMS encryption key. If you don't specify a value for <code>KmsKeyId</code>, then the copy of the elastic cluster snapshot is encrypted with the same <code>AWS</code> KMS key as the source elastic cluster snapshot.</p> <p>To copy an encrypted elastic cluster snapshot to another Amazon Web Services region, set <code>KmsKeyId</code> to the Amazon Web Services KMS key ID that you want to use to encrypt the copy of the elastic cluster snapshot in the destination region. Amazon Web Services KMS encryption keys are specific to the Amazon Web Services region that they are created in, and you can't use encryption keys from one Amazon Web Services region in another Amazon Web Services region.</p> <p>If you copy an unencrypted elastic cluster snapshot and specify a value for the <code>KmsKeyId</code> parameter, an error is returned.</p>
        copy_tags: <p>Set to <code>true</code> to copy all tags from the source cluster snapshot to the target elastic cluster snapshot. The default is <code>false</code>.</p>
        tags: <p>The tags to be assigned to the elastic cluster snapshot.</p>

    Raises:
        capo_docdb_elastic.errors.access_denied_exception.AccessDeniedException: <p>An exception that occurs when there are not sufficient permissions to perform an action.</p>
        capo_docdb_elastic.errors.conflict_exception.ConflictException: <p>There was an access conflict.</p>
        capo_docdb_elastic.errors.internal_server_exception.InternalServerException: <p>There was an internal server error.</p>
        capo_docdb_elastic.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be located.</p>
        capo_docdb_elastic.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota for the action was exceeded.</p>
        capo_docdb_elastic.errors.throttling_exception.ThrottlingException: <p>ThrottlingException will be thrown when request was denied due to request throttling.</p>
        capo_docdb_elastic.errors.validation_exception.ValidationException: <p>A structure defining a validation exception.</p>
        capo_docdb_elastic.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Basic Copy Cluster Snapshot Example
        update applied

        >>> client.copy_cluster_snapshot(snapshot_arn='arn:aws:docdb-elastic:us-east-1:$AWS_ACCOUNT_ID:cluster-snapshot/$SOURCE_SNAPSHOT_ID', target_snapshot_name='sampleSnapshotName')
    """

    def _handler(
        req: "OperationRequest[capo_docdb_elastic.types.copy_cluster_snapshot_input.CopyClusterSnapshotInput]",
    ) -> OperationResponse[
        "capo_docdb_elastic.types.copy_cluster_snapshot_output.CopyClusterSnapshotOutput"
    ]:
        import capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.copy_cluster_snapshot

        output, http_response = (
            capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.copy_cluster_snapshot.copy_cluster_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyClusterSnapshot")
    )
    input_: capo_docdb_elastic.types.copy_cluster_snapshot_input.CopyClusterSnapshotInput = {
        "snapshot_arn": snapshot_arn,
        "target_snapshot_name": target_snapshot_name,
    }
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if copy_tags is not None:
        input_["copy_tags"] = copy_tags
    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