Skip to content

restore_db_cluster_to_point_in_time

restore_db_cluster_to_point_in_time(
    *,
    config_overrides: Optional[NeptuneClientConfig] = None,
    db_cluster_identifier: Optional[String] = None,
    restore_type: Optional[String] = None,
    source_db_cluster_identifier: Optional[String] = None,
    restore_to_time: Optional[TStamp] = None,
    use_latest_restorable_time: Optional[Boolean] = None,
    port: Optional[IntegerOptional] = None,
    db_subnet_group_name: Optional[String] = None,
    option_group_name: Optional[String] = None,
    vpc_security_group_ids: Optional[VpcSecurityGroupIdList] = None,
    tags: Optional[TagList] = None,
    kms_key_id: Optional[String] = None,
    enable_iam_database_authentication: Optional[BooleanOptional] = None,
    enable_cloudwatch_logs_exports: Optional[LogTypeList] = None,
    db_cluster_parameter_group_name: Optional[String] = None,
    deletion_protection: Optional[BooleanOptional] = None,
    serverless_v2_scaling_configuration: Optional[
        ServerlessV2ScalingConfiguration
    ] = None,
    storage_type: Optional[String] = None,
    network_type: Optional[String] = None,
) -> RestoreDBClusterToPointInTimeResult

Restores a DB cluster to an arbitrary point in time. Users can restore to any point in time before LatestRestorableTime for up to BackupRetentionPeriod days. The target DB cluster is created from the source DB cluster with the same configuration as the original DB cluster, except that the new DB cluster is created with the default DB security group.

This action only restores the DB cluster, not the DB instances for that DB cluster. You must invoke the CreateDBInstance action to create DB instances for the restored DB cluster, specifying the identifier of the restored DB cluster in DBClusterIdentifier. You can create DB instances only after the RestoreDBClusterToPointInTime action has completed and the DB cluster is available.

Parameters:

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

    The name of the new DB cluster to be created.

    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

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

    The type of restore to be performed. You can specify one of the following values:

    • full-copy - The new DB cluster is restored as a full copy of the source DB cluster.

    • copy-on-write - The new DB cluster is restored as a clone of the source DB cluster.

    If you don't specify a RestoreType value, then the new DB cluster is restored as a full copy of the source DB cluster.

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

    The identifier of the source DB cluster from which to restore.

    Constraints:

    • Must match the identifier of an existing DBCluster.

  • restore_to_time (Optional[TStamp], default: None ) –

    The date and time to restore the DB cluster to.

    Valid Values: Value must be a time in Universal Coordinated Time (UTC) format

    Constraints:

    • Must be before the latest restorable time for the DB instance

    • Must be specified if UseLatestRestorableTime parameter is not provided

    • Cannot be specified if UseLatestRestorableTime parameter is true

    • Cannot be specified if RestoreType parameter is copy-on-write

    Example: 2015-03-07T23:45:00Z

  • use_latest_restorable_time (Optional[Boolean], default: None ) –

    A value that is set to true to restore the DB cluster to the latest restorable backup time, and false otherwise.

    Default: false

    Constraints: Cannot be specified if RestoreToTime parameter is provided.

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

    The port number on which the new DB cluster accepts connections.

    Constraints: Value must be 1150-65535

    Default: The same port as the original DB cluster.

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

    The DB subnet group name to use for the new DB cluster.

    Constraints: If supplied, must match the name of an existing DBSubnetGroup.

    Example: mySubnetgroup

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

    (Not supported by Neptune)

  • vpc_security_group_ids (Optional[VpcSecurityGroupIdList], default: None ) –

    A list of VPC security groups that the new DB cluster belongs to.

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

    The tags to be applied to the restored DB cluster.

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

    The Amazon KMS key identifier to use when restoring an encrypted DB cluster from an encrypted DB cluster.

    The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are restoring a DB cluster with the same Amazon account that owns the KMS encryption key used to encrypt the new DB cluster, then you can use the KMS key alias instead of the ARN for the KMS encryption key.

    You can restore to a new DB cluster and encrypt the new DB cluster with a KMS key that is different than the KMS key used to encrypt the source DB cluster. The new DB cluster is encrypted with the KMS key identified by the KmsKeyId parameter.

    If you do not specify a value for the KmsKeyId parameter, then the following will occur:

    • If the DB cluster is encrypted, then the restored DB cluster is encrypted using the KMS key that was used to encrypt the source DB cluster.

    • If the DB cluster is not encrypted, then the restored DB cluster is not encrypted.

    If DBClusterIdentifier refers to a DB cluster that is not encrypted, then the restore request is rejected.

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

    True to enable mapping of Amazon Identity and Access Management (IAM) accounts to database accounts, and otherwise false.

    Default: false

  • enable_cloudwatch_logs_exports (Optional[LogTypeList], default: None ) –

    The list of logs that the restored DB cluster is to export to CloudWatch Logs.

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

    The name of the DB cluster parameter group to associate with the new DB cluster.

    Constraints:

    • If supplied, must match the name of an existing DBClusterParameterGroup.

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

    A value that indicates whether the DB cluster has deletion protection enabled. The database can't be deleted when deletion protection is enabled. By default, deletion protection is disabled.

  • serverless_v2_scaling_configuration (Optional[ServerlessV2ScalingConfiguration], default: None ) –

    Contains the scaling configuration of a Neptune Serverless DB cluster.

    For more information, see Using Amazon Neptune Serverless in the Amazon Neptune User Guide.

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

    Specifies the storage type to be associated with the DB cluster.

    Valid values: standard, iopt1

    Default: standard

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

    The network type of the DB cluster.

    Valid Values:

    • IPV4 – ( the default ) The DB cluster uses only IPv4 addresses for communication.

    • DUAL – The DB cluster uses both IPv4 and IPv6 addresses for communication. The DB subnet group associated with the cluster must support IPv6.

Raises:

Source code in docs_src/capo_neptune/_services/neptune.py
def restore_db_cluster_to_point_in_time(
    self,
    *,
    config_overrides: Optional[NeptuneClientConfig] = None,
    db_cluster_identifier: Optional["capo_neptune.types.string.String"] = None,
    restore_type: Optional["capo_neptune.types.string.String"] = None,
    source_db_cluster_identifier: Optional[
        "capo_neptune.types.string.String"
    ] = None,
    restore_to_time: Optional["capo_neptune.types.t_stamp.TStamp"] = None,
    use_latest_restorable_time: Optional[
        "capo_neptune.types.boolean.Boolean"
    ] = None,
    port: Optional["capo_neptune.types.integer_optional.IntegerOptional"] = None,
    db_subnet_group_name: Optional["capo_neptune.types.string.String"] = None,
    option_group_name: Optional["capo_neptune.types.string.String"] = None,
    vpc_security_group_ids: Optional[
        "capo_neptune.types.vpc_security_group_id_list.VpcSecurityGroupIdList"
    ] = None,
    tags: Optional["capo_neptune.types.tag_list.TagList"] = None,
    kms_key_id: Optional["capo_neptune.types.string.String"] = None,
    enable_iam_database_authentication: Optional[
        "capo_neptune.types.boolean_optional.BooleanOptional"
    ] = None,
    enable_cloudwatch_logs_exports: Optional[
        "capo_neptune.types.log_type_list.LogTypeList"
    ] = None,
    db_cluster_parameter_group_name: Optional[
        "capo_neptune.types.string.String"
    ] = None,
    deletion_protection: Optional[
        "capo_neptune.types.boolean_optional.BooleanOptional"
    ] = None,
    serverless_v2_scaling_configuration: Optional[
        "capo_neptune.types.serverless_v2_scaling_configuration.ServerlessV2ScalingConfiguration"
    ] = None,
    storage_type: Optional["capo_neptune.types.string.String"] = None,
    network_type: Optional["capo_neptune.types.string.String"] = None,
) -> "capo_neptune.types.restore_db_cluster_to_point_in_time_result.RestoreDBClusterToPointInTimeResult":
    """<p>Restores a DB cluster to an arbitrary point in time. Users can restore to any point in time before <code>LatestRestorableTime</code> for up to <code>BackupRetentionPeriod</code> days. The target DB cluster is created from the source DB cluster with the same configuration as the original DB cluster, except that the new DB cluster is created with the default DB security group.</p> <note> <p>This action only restores the DB cluster, not the DB instances for that DB cluster. You must invoke the <a>CreateDBInstance</a> action to create DB instances for the restored DB cluster, specifying the identifier of the restored DB cluster in <code>DBClusterIdentifier</code>. You can create DB instances only after the <code>RestoreDBClusterToPointInTime</code> action has completed and the DB cluster is available.</p> </note>

    Args:
        db_cluster_identifier: <p>The name of the new DB cluster to be created.</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>
        restore_type: <p>The type of restore to be performed. You can specify one of the following values:</p> <ul> <li> <p> <code>full-copy</code> - The new DB cluster is restored as a full copy of the source DB cluster.</p> </li> <li> <p> <code>copy-on-write</code> - The new DB cluster is restored as a clone of the source DB cluster.</p> </li> </ul> <p>If you don't specify a <code>RestoreType</code> value, then the new DB cluster is restored as a full copy of the source DB cluster.</p>
        source_db_cluster_identifier: <p>The identifier of the source DB cluster from which to restore.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing DBCluster.</p> </li> </ul>
        restore_to_time: <p>The date and time to restore the DB cluster to.</p> <p>Valid Values: Value must be a time in Universal Coordinated Time (UTC) format</p> <p>Constraints:</p> <ul> <li> <p>Must be before the latest restorable time for the DB instance</p> </li> <li> <p>Must be specified if <code>UseLatestRestorableTime</code> parameter is not provided</p> </li> <li> <p>Cannot be specified if <code>UseLatestRestorableTime</code> parameter is true</p> </li> <li> <p>Cannot be specified if <code>RestoreType</code> parameter is <code>copy-on-write</code> </p> </li> </ul> <p>Example: <code>2015-03-07T23:45:00Z</code> </p>
        use_latest_restorable_time: <p>A value that is set to <code>true</code> to restore the DB cluster to the latest restorable backup time, and <code>false</code> otherwise.</p> <p>Default: <code>false</code> </p> <p>Constraints: Cannot be specified if <code>RestoreToTime</code> parameter is provided.</p>
        port: <p>The port number on which the new DB cluster accepts connections.</p> <p>Constraints: Value must be <code>1150-65535</code> </p> <p>Default: The same port as the original DB cluster.</p>
        db_subnet_group_name: <p>The DB subnet group name to use for the new DB cluster.</p> <p>Constraints: If supplied, must match the name of an existing DBSubnetGroup.</p> <p>Example: <code>mySubnetgroup</code> </p>
        option_group_name: <p> <i>(Not supported by Neptune)</i> </p>
        vpc_security_group_ids: <p>A list of VPC security groups that the new DB cluster belongs to.</p>
        tags: <p>The tags to be applied to the restored DB cluster.</p>
        kms_key_id: <p>The Amazon KMS key identifier to use when restoring an encrypted DB cluster from an encrypted DB cluster.</p> <p>The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are restoring a DB cluster with the same Amazon account that owns the KMS encryption key used to encrypt the new DB cluster, then you can use the KMS key alias instead of the ARN for the KMS encryption key.</p> <p>You can restore to a new DB cluster and encrypt the new DB cluster with a KMS key that is different than the KMS key used to encrypt the source DB cluster. The new DB cluster is encrypted with the KMS key identified by the <code>KmsKeyId</code> parameter.</p> <p>If you do not specify a value for the <code>KmsKeyId</code> parameter, then the following will occur:</p> <ul> <li> <p>If the DB cluster is encrypted, then the restored DB cluster is encrypted using the KMS key that was used to encrypt the source DB cluster.</p> </li> <li> <p>If the DB cluster is not encrypted, then the restored DB cluster is not encrypted.</p> </li> </ul> <p>If <code>DBClusterIdentifier</code> refers to a DB cluster that is not encrypted, then the restore request is rejected.</p>
        enable_iam_database_authentication: <p>True to enable mapping of Amazon Identity and Access Management (IAM) accounts to database accounts, and otherwise false.</p> <p>Default: <code>false</code> </p>
        enable_cloudwatch_logs_exports: <p>The list of logs that the restored DB cluster is to export to CloudWatch Logs.</p>
        db_cluster_parameter_group_name: <p>The name of the DB cluster parameter group to associate with the new DB cluster.</p> <p>Constraints:</p> <ul> <li> <p>If supplied, must match the name of an existing DBClusterParameterGroup.</p> </li> </ul>
        deletion_protection: <p>A value that indicates whether the DB cluster has deletion protection enabled. The database can't be deleted when deletion protection is enabled. By default, deletion protection is disabled. </p>
        serverless_v2_scaling_configuration: <p>Contains the scaling configuration of a Neptune Serverless DB cluster.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/neptune/latest/userguide/neptune-serverless-using.html">Using Amazon Neptune Serverless</a> in the <i>Amazon Neptune User Guide</i>.</p>
        storage_type: <p>Specifies the storage type to be associated with the DB cluster.</p> <p>Valid values: <code>standard</code>, <code>iopt1</code> </p> <p>Default: <code>standard</code> </p>
        network_type: <p>The network type of the DB cluster.</p> <p>Valid Values:</p> <ul> <li> <p> <b> <code>IPV4</code> </b> – ( <i>the default</i> ) The DB cluster uses only IPv4 addresses for communication.</p> </li> <li> <p> <b> <code>DUAL</code> </b> – The DB cluster uses both IPv4 and IPv6 addresses for communication. The DB subnet group associated with the cluster must support IPv6.</p> </li> </ul>

    Raises:
        capo_neptune.errors.db_cluster_already_exists_fault.DBClusterAlreadyExistsFault: <p>User already has a DB cluster with the given identifier.</p>
        capo_neptune.errors.db_cluster_not_found_fault.DBClusterNotFoundFault: <p> <i>DBClusterIdentifier</i> does not refer to an existing DB cluster.</p>
        capo_neptune.errors.db_cluster_parameter_group_not_found_fault.DBClusterParameterGroupNotFoundFault: <p> <i>DBClusterParameterGroupName</i> does not refer to an existing DB Cluster parameter group.</p>
        capo_neptune.errors.db_cluster_quota_exceeded_fault.DBClusterQuotaExceededFault: <p>User attempted to create a new DB cluster and the user has already reached the maximum allowed DB cluster quota.</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.db_subnet_group_not_found_fault.DBSubnetGroupNotFoundFault: <p> <i>DBSubnetGroupName</i> does not refer to an existing DB subnet group.</p>
        capo_neptune.errors.insufficient_db_cluster_capacity_fault.InsufficientDBClusterCapacityFault: <p>The DB cluster does not have enough capacity for the current operation.</p>
        capo_neptune.errors.insufficient_storage_cluster_capacity_fault.InsufficientStorageClusterCapacityFault: <p>There is insufficient storage available for the current action. You may be able to resolve this error by updating your subnet group to use different Availability Zones that have more storage available.</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.invalid_db_snapshot_state_fault.InvalidDBSnapshotStateFault: <p>The state of the DB snapshot does not allow deletion.</p>
        capo_neptune.errors.invalid_restore_fault.InvalidRestoreFault: <p>Cannot restore from vpc backup to non-vpc DB instance.</p>
        capo_neptune.errors.invalid_subnet.InvalidSubnet: <p>The requested subnet is invalid, or multiple subnets were requested that are not all in a common VPC.</p>
        capo_neptune.errors.invalid_vpc_network_state_fault.InvalidVPCNetworkStateFault: <p>DB subnet group does not cover all Availability Zones after it is created because users' change.</p>
        capo_neptune.errors.kms_key_not_accessible_fault.KMSKeyNotAccessibleFault: <p>Error accessing KMS key.</p>
        capo_neptune.errors.network_type_not_supported_fault.NetworkTypeNotSupportedFault: <p>The specified <i>NetworkType</i> is not supported for the DB cluster, DB subnet group, or orderable DB instance option.</p>
        capo_neptune.errors.option_group_not_found_fault.OptionGroupNotFoundFault: <p>The designated option group could not be found.</p>
        capo_neptune.errors.storage_quota_exceeded_fault.StorageQuotaExceededFault: <p>Request would result in user exceeding the allowed amount of storage available across all DB instances.</p>
        capo_neptune.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_neptune.types.restore_db_cluster_to_point_in_time_message.RestoreDBClusterToPointInTimeMessage]",
    ) -> OperationResponse[
        "capo_neptune.types.restore_db_cluster_to_point_in_time_result.RestoreDBClusterToPointInTimeResult"
    ]:
        import capo_neptune._operations.amazon_rd_sv19.restore_db_cluster_to_point_in_time

        output, http_response = (
            capo_neptune._operations.amazon_rd_sv19.restore_db_cluster_to_point_in_time.restore_db_cluster_to_point_in_time(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreDBClusterToPointInTime")
    )
    input_: capo_neptune.types.restore_db_cluster_to_point_in_time_message.RestoreDBClusterToPointInTimeMessage = {}
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier
    if restore_type is not None:
        input_["restore_type"] = restore_type
    if source_db_cluster_identifier is not None:
        input_["source_db_cluster_identifier"] = source_db_cluster_identifier
    if restore_to_time is not None:
        input_["restore_to_time"] = restore_to_time
    if use_latest_restorable_time is not None:
        input_["use_latest_restorable_time"] = use_latest_restorable_time
    if port is not None:
        input_["port"] = port
    if db_subnet_group_name is not None:
        input_["db_subnet_group_name"] = db_subnet_group_name
    if option_group_name is not None:
        input_["option_group_name"] = option_group_name
    if vpc_security_group_ids is not None:
        input_["vpc_security_group_ids"] = vpc_security_group_ids
    if tags is not None:
        input_["tags"] = tags
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if enable_iam_database_authentication is not None:
        input_["enable_iam_database_authentication"] = (
            enable_iam_database_authentication
        )
    if enable_cloudwatch_logs_exports is not None:
        input_["enable_cloudwatch_logs_exports"] = enable_cloudwatch_logs_exports
    if db_cluster_parameter_group_name is not None:
        input_["db_cluster_parameter_group_name"] = db_cluster_parameter_group_name
    if deletion_protection is not None:
        input_["deletion_protection"] = deletion_protection
    if serverless_v2_scaling_configuration is not None:
        input_["serverless_v2_scaling_configuration"] = (
            serverless_v2_scaling_configuration
        )
    if storage_type is not None:
        input_["storage_type"] = storage_type
    if network_type is not None:
        input_["network_type"] = network_type

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