Skip to content

copy_cluster_snapshot async

copy_cluster_snapshot(
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    source_snapshot_identifier: Optional[String] = None,
    source_snapshot_cluster_identifier: Optional[String] = None,
    target_snapshot_identifier: Optional[String] = None,
    manual_snapshot_retention_period: Optional[IntegerOptional] = None,
) -> CopyClusterSnapshotResult

Copies the specified automated cluster snapshot to a new manual cluster snapshot. The source must be an automated snapshot and it must be in the available state.

When you delete a cluster, Amazon Redshift deletes any automated snapshots of the cluster. Also, when the retention period of the snapshot expires, Amazon Redshift automatically deletes it. If you want to keep an automated snapshot for a longer period, you can make a manual copy of the snapshot. Manual snapshots are retained until you delete them.

For more information about working with snapshots, go to Amazon Redshift Snapshots in the Amazon Redshift Cluster Management Guide.

Parameters:

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

    The identifier for the source snapshot.

    Constraints:

    • Must be the identifier for a valid automated snapshot whose state is available.

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

    The identifier of the cluster the source snapshot was created from. This parameter is required if your IAM user has a policy containing a snapshot resource element that specifies anything other than * for the cluster name.

    Constraints:

    • Must be the identifier for a valid cluster.

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

    The identifier given to the new manual snapshot.

    Constraints:

    • Cannot be null, empty, or blank.

    • Must contain from 1 to 255 alphanumeric characters or hyphens.

    • First character must be a letter.

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

    • Must be unique for the Amazon Web Services account that is making the request.

  • manual_snapshot_retention_period (Optional[IntegerOptional], default: None ) –

    The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.

    The value must be either -1 or an integer between 1 and 3,653.

    The default value is -1.

Raises:

Source code in docs_src/capo_redshift/_services/async_redshift.py
async def copy_cluster_snapshot(
    self,
    *,
    config_overrides: Optional[AsyncRedshiftClientConfig] = None,
    source_snapshot_identifier: Optional[
        "capo_redshift.types.string.String"
    ] = None,
    source_snapshot_cluster_identifier: Optional[
        "capo_redshift.types.string.String"
    ] = None,
    target_snapshot_identifier: Optional[
        "capo_redshift.types.string.String"
    ] = None,
    manual_snapshot_retention_period: Optional[
        "capo_redshift.types.integer_optional.IntegerOptional"
    ] = None,
) -> "capo_redshift.types.copy_cluster_snapshot_result.CopyClusterSnapshotResult":
    """<p>Copies the specified automated cluster snapshot to a new manual cluster snapshot. The source must be an automated snapshot and it must be in the available state.</p> <p>When you delete a cluster, Amazon Redshift deletes any automated snapshots of the cluster. Also, when the retention period of the snapshot expires, Amazon Redshift automatically deletes it. If you want to keep an automated snapshot for a longer period, you can make a manual copy of the snapshot. Manual snapshots are retained until you delete them.</p> <p> For more information about working with snapshots, go to <a href="https://docs.aws.amazon.com/redshift/latest/mgmt/working-with-snapshots.html">Amazon Redshift Snapshots</a> in the <i>Amazon Redshift Cluster Management Guide</i>.</p>

    Args:
        source_snapshot_identifier: <p>The identifier for the source snapshot.</p> <p>Constraints:</p> <ul> <li> <p>Must be the identifier for a valid automated snapshot whose state is <code>available</code>.</p> </li> </ul>
        source_snapshot_cluster_identifier: <p>The identifier of the cluster the source snapshot was created from. This parameter is required if your IAM user has a policy containing a snapshot resource element that specifies anything other than * for the cluster name.</p> <p>Constraints:</p> <ul> <li> <p>Must be the identifier for a valid cluster.</p> </li> </ul>
        target_snapshot_identifier: <p>The identifier given to the new manual snapshot.</p> <p>Constraints:</p> <ul> <li> <p>Cannot be null, empty, or blank.</p> </li> <li> <p>Must contain from 1 to 255 alphanumeric characters 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> <li> <p>Must be unique for the Amazon Web Services account that is making the request.</p> </li> </ul>
        manual_snapshot_retention_period: <p>The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely. </p> <p>The value must be either -1 or an integer between 1 and 3,653.</p> <p>The default value is -1.</p>

    Raises:
        capo_redshift.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The <code>ClusterIdentifier</code> parameter does not refer to an existing cluster. </p>
        capo_redshift.errors.cluster_snapshot_already_exists_fault.ClusterSnapshotAlreadyExistsFault: <p>The value specified as a snapshot identifier is already used by an existing snapshot.</p>
        capo_redshift.errors.cluster_snapshot_not_found_fault.ClusterSnapshotNotFoundFault: <p>The snapshot identifier does not refer to an existing cluster snapshot.</p>
        capo_redshift.errors.cluster_snapshot_quota_exceeded_fault.ClusterSnapshotQuotaExceededFault: <p>The request would result in the user exceeding the allowed number of cluster snapshots.</p>
        capo_redshift.errors.invalid_cluster_snapshot_state_fault.InvalidClusterSnapshotStateFault: <p>The specified cluster snapshot is not in the <code>available</code> state, or other accounts are authorized to access the snapshot. </p>
        capo_redshift.errors.invalid_retention_period_fault.InvalidRetentionPeriodFault: <p>The retention period specified is either in the past or is not a valid value.</p> <p>The value must be either -1 or an integer between 1 and 3,653.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_redshift.types.copy_cluster_snapshot_message.CopyClusterSnapshotMessage]",
    ) -> AsyncOperationResponse[
        "capo_redshift.types.copy_cluster_snapshot_result.CopyClusterSnapshotResult"
    ]:
        import capo_redshift._operations.redshift_service_version20121201.copy_cluster_snapshot

        (
            output,
            http_response,
        ) = await capo_redshift._operations.redshift_service_version20121201.copy_cluster_snapshot.async_copy_cluster_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CopyClusterSnapshot")
    )
    input_: capo_redshift.types.copy_cluster_snapshot_message.CopyClusterSnapshotMessage = {}
    if source_snapshot_identifier is not None:
        input_["source_snapshot_identifier"] = source_snapshot_identifier
    if source_snapshot_cluster_identifier is not None:
        input_["source_snapshot_cluster_identifier"] = (
            source_snapshot_cluster_identifier
        )
    if target_snapshot_identifier is not None:
        input_["target_snapshot_identifier"] = target_snapshot_identifier
    if manual_snapshot_retention_period is not None:
        input_["manual_snapshot_retention_period"] = (
            manual_snapshot_retention_period
        )

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