Skip to content

enable_snapshot_copy

enable_snapshot_copy(
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    cluster_identifier: Optional[String] = None,
    destination_region: Optional[String] = None,
    retention_period: Optional[IntegerOptional] = None,
    snapshot_copy_grant_name: Optional[String] = None,
    manual_snapshot_retention_period: Optional[IntegerOptional] = None,
) -> EnableSnapshotCopyResult

Enables the automatic copy of snapshots from one region to another region for a specified cluster.

Parameters:

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

    The unique identifier of the source cluster to copy snapshots from.

    Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.

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

    The destination Amazon Web Services Region that you want to copy snapshots to.

    Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see Regions and Endpoints in the Amazon Web Services General Reference.

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

    The number of days to retain automated snapshots in the destination region after they are copied from the source region.

    Default: 7.

    Constraints: Must be at least 1 and no more than 35.

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

    The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are copied to the destination region.

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

    The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. 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.

Raises:

Source code in docs_src/capo_redshift/_services/redshift.py
def enable_snapshot_copy(
    self,
    *,
    config_overrides: Optional[RedshiftClientConfig] = None,
    cluster_identifier: Optional["capo_redshift.types.string.String"] = None,
    destination_region: Optional["capo_redshift.types.string.String"] = None,
    retention_period: Optional[
        "capo_redshift.types.integer_optional.IntegerOptional"
    ] = None,
    snapshot_copy_grant_name: Optional["capo_redshift.types.string.String"] = None,
    manual_snapshot_retention_period: Optional[
        "capo_redshift.types.integer_optional.IntegerOptional"
    ] = None,
) -> "capo_redshift.types.enable_snapshot_copy_result.EnableSnapshotCopyResult":
    """<p>Enables the automatic copy of snapshots from one region to another region for a specified cluster.</p>

    Args:
        cluster_identifier: <p>The unique identifier of the source cluster to copy snapshots from.</p> <p>Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.</p>
        destination_region: <p>The destination Amazon Web Services Region that you want to copy snapshots to.</p> <p>Constraints: Must be the name of a valid Amazon Web Services Region. For more information, see <a href="https://docs.aws.amazon.com/general/latest/gr/rande.html#redshift_region">Regions and Endpoints</a> in the Amazon Web Services General Reference. </p>
        retention_period: <p>The number of days to retain automated snapshots in the destination region after they are copied from the source region.</p> <p>Default: 7.</p> <p>Constraints: Must be at least 1 and no more than 35.</p>
        snapshot_copy_grant_name: <p>The name of the snapshot copy grant to use when snapshots of an Amazon Web Services KMS-encrypted cluster are copied to the destination region.</p>
        manual_snapshot_retention_period: <p>The number of days to retain newly copied snapshots in the destination Amazon Web Services Region after they are copied from the source Amazon Web Services Region. 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>

    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.copy_to_region_disabled_fault.CopyToRegionDisabledFault: <p>Cross-region snapshot copy was temporarily disabled. Try your request again.</p>
        capo_redshift.errors.dependent_service_request_throttling_fault.DependentServiceRequestThrottlingFault: <p>The request cannot be completed because a dependent service is throttling requests made by Amazon Redshift on your behalf. Wait and retry the request.</p>
        capo_redshift.errors.incompatible_orderable_options.IncompatibleOrderableOptions: <p>The specified options are incompatible.</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.limit_exceeded_fault.LimitExceededFault: <p>The encryption key has exceeded its grant limit in Amazon Web Services KMS.</p>
        capo_redshift.errors.snapshot_copy_already_enabled_fault.SnapshotCopyAlreadyEnabledFault: <p>The cluster already has cross-region snapshot copy enabled.</p>
        capo_redshift.errors.snapshot_copy_grant_not_found_fault.SnapshotCopyGrantNotFoundFault: <p>The specified snapshot copy grant can't be found. Make sure that the name is typed correctly and that the grant exists in the destination region.</p>
        capo_redshift.errors.unauthorized_operation.UnauthorizedOperation: <p>Your account is not authorized to perform the requested operation.</p>
        capo_redshift.errors.unknown_snapshot_copy_region_fault.UnknownSnapshotCopyRegionFault: <p>The specified region is incorrect or does not exist.</p>
        capo_redshift.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_redshift.types.enable_snapshot_copy_message.EnableSnapshotCopyMessage]",
    ) -> OperationResponse[
        "capo_redshift.types.enable_snapshot_copy_result.EnableSnapshotCopyResult"
    ]:
        import capo_redshift._operations.redshift_service_version20121201.enable_snapshot_copy

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

    def _redact_output(
        output: "capo_redshift.types.enable_snapshot_copy_result.EnableSnapshotCopyResult",
    ) -> dict[str, Any]:
        import capo_redshift.types.enable_snapshot_copy_result

        return capo_redshift.types.enable_snapshot_copy_result.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("EnableSnapshotCopy", redact_output=_redact_output),
    )
    input_: capo_redshift.types.enable_snapshot_copy_message.EnableSnapshotCopyMessage = {}
    if cluster_identifier is not None:
        input_["cluster_identifier"] = cluster_identifier
    if destination_region is not None:
        input_["destination_region"] = destination_region
    if retention_period is not None:
        input_["retention_period"] = retention_period
    if snapshot_copy_grant_name is not None:
        input_["snapshot_copy_grant_name"] = snapshot_copy_grant_name
    if manual_snapshot_retention_period is not None:
        input_["manual_snapshot_retention_period"] = (
            manual_snapshot_retention_period
        )

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output