Skip to content

create_cluster_snapshot

create_cluster_snapshot(
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    snapshot_identifier: Optional[String] = None,
    cluster_identifier: Optional[String] = None,
    manual_snapshot_retention_period: Optional[IntegerOptional] = None,
    tags: Optional[TagList] = None,
) -> CreateClusterSnapshotResult

Creates a manual snapshot of the specified cluster. The cluster must be in the available state.

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

Parameters:

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

    A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the Amazon Web Services account.

    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

    Example: my-snapshot-id

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

    The cluster identifier for which you want a snapshot.

  • 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.

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

    A list of tag instances.

Raises:

Source code in docs_src/capo_redshift/_services/redshift.py
def create_cluster_snapshot(
    self,
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    snapshot_identifier: Optional["capo_redshift.types.string.String"] = None,
    cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
    manual_snapshot_retention_period: Optional[
        "capo_redshift.types.integer_optional.IntegerOptional"
    ] = None,
    tags: Optional["capo_redshift.types.tag_list.TagList"] = None,
) -> (
    "capo_redshift.types.create_cluster_snapshot_result.CreateClusterSnapshotResult"
):
    """<p>Creates a manual snapshot of the specified cluster. The cluster must be in the <code>available</code> state. </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:
        snapshot_identifier: <p>A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the Amazon Web Services account.</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> </ul> <p>Example: <code>my-snapshot-id</code> </p>
        cluster_identifier: <p>The cluster identifier for which you want a snapshot.</p>
        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>
        tags: <p>A list of tag instances.</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_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_state_fault.InvalidClusterStateFault: <p>The specified cluster is not in the <code>available</code> state. </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.invalid_tag_fault.InvalidTagFault: <p>The tag is invalid.</p>
        capo_redshift.errors.tag_limit_exceeded_fault.TagLimitExceededFault: <p>You have exceeded the number of tags allowed.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift.types.create_cluster_snapshot_message.CreateClusterSnapshotMessage]",
    ) -> OperationResponse[
        "capo_redshift.types.create_cluster_snapshot_result.CreateClusterSnapshotResult"
    ]:
        import capo_redshift._operations.redshift_service_version20121201.create_cluster_snapshot

        output, http_response = (
            capo_redshift._operations.redshift_service_version20121201.create_cluster_snapshot.create_cluster_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateClusterSnapshot")
    )
    input_: capo_redshift.types.create_cluster_snapshot_message.CreateClusterSnapshotMessage = {}
    if snapshot_identifier is not None:
        input_["snapshot_identifier"] = snapshot_identifier
    if cluster_identifier is not None:
        input_["cluster_identifier"] = cluster_identifier
    if manual_snapshot_retention_period is not None:
        input_["manual_snapshot_retention_period"] = (
            manual_snapshot_retention_period
        )
    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