Skip to content

restore_db_cluster_from_snapshot async

restore_db_cluster_from_snapshot(
    *,
    config_overrides: Optional[AsyncNeptuneClientConfig] = None,
    availability_zones: Optional[AvailabilityZones] = None,
    db_cluster_identifier: Optional[String] = None,
    snapshot_identifier: Optional[String] = None,
    engine: Optional[String] = None,
    engine_version: Optional[String] = None,
    port: Optional[IntegerOptional] = None,
    db_subnet_group_name: Optional[String] = None,
    database_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,
    copy_tags_to_snapshot: Optional[BooleanOptional] = None,
    serverless_v2_scaling_configuration: Optional[
        ServerlessV2ScalingConfiguration
    ] = None,
    storage_type: Optional[String] = None,
    network_type: Optional[String] = None,
) -> RestoreDBClusterFromSnapshotResult

Creates a new DB cluster from a DB snapshot or DB cluster snapshot.

If a DB snapshot is specified, the target DB cluster is created from the source DB snapshot with a default configuration and default security group.

If a DB cluster snapshot is specified, the target DB cluster is created from the source DB cluster restore point with the same configuration as the original source DB cluster, except that the new DB cluster is created with the default security group.

Parameters:

  • availability_zones (Optional[AvailabilityZones], default: None ) –

    Provides the list of EC2 Availability Zones that instances in the restored DB cluster can be created in.

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

    The name of the DB cluster to create from the DB snapshot or DB cluster snapshot. This parameter isn't case-sensitive.

    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

    Example: my-snapshot-id

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

    The identifier for the DB snapshot or DB cluster snapshot to restore from.

    You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. However, you can use only the ARN to specify a DB snapshot.

    Constraints:

    • Must match the identifier of an existing Snapshot.

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

    The database engine to use for the new DB cluster.

    Default: The same as source

    Constraint: Must be compatible with the engine of the source

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

    The version of the database engine to use for the new DB cluster.

  • 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 name of the DB subnet group to use for the new DB cluster.

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

    Example: mySubnetgroup

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

    Not supported.

  • 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 will belong to.

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

    The tags to be assigned 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 a DB snapshot or DB cluster snapshot.

    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.

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

    • If the DB snapshot or DB cluster snapshot in SnapshotIdentifier is encrypted, then the restored DB cluster is encrypted using the KMS key that was used to encrypt the DB snapshot or DB cluster snapshot.

    • If the DB snapshot or DB cluster snapshot in SnapshotIdentifier is not encrypted, then the restored DB cluster is not encrypted.

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

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

    If set to true, tags are copied to any snapshot of the restored DB cluster that is created.

  • 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/async_neptune.py
async def restore_db_cluster_from_snapshot(
    self,
    *,
    config_overrides: Optional[AsyncNeptuneClientConfig] = None,
    availability_zones: Optional[
        "capo_neptune.types.availability_zones.AvailabilityZones"
    ] = None,
    db_cluster_identifier: Optional["capo_neptune.types.string.String"] = None,
    snapshot_identifier: Optional["capo_neptune.types.string.String"] = None,
    engine: Optional["capo_neptune.types.string.String"] = None,
    engine_version: Optional["capo_neptune.types.string.String"] = None,
    port: Optional["capo_neptune.types.integer_optional.IntegerOptional"] = None,
    db_subnet_group_name: Optional["capo_neptune.types.string.String"] = None,
    database_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,
    copy_tags_to_snapshot: 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_from_snapshot_result.RestoreDBClusterFromSnapshotResult":
    """<p>Creates a new DB cluster from a DB snapshot or DB cluster snapshot.</p> <p>If a DB snapshot is specified, the target DB cluster is created from the source DB snapshot with a default configuration and default security group.</p> <p>If a DB cluster snapshot is specified, the target DB cluster is created from the source DB cluster restore point with the same configuration as the original source DB cluster, except that the new DB cluster is created with the default security group.</p>

    Args:
        availability_zones: <p>Provides the list of EC2 Availability Zones that instances in the restored DB cluster can be created in.</p>
        db_cluster_identifier: <p>The name of the DB cluster to create from the DB snapshot or DB cluster snapshot. This parameter isn't case-sensitive.</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> <p>Example: <code>my-snapshot-id</code> </p>
        snapshot_identifier: <p>The identifier for the DB snapshot or DB cluster snapshot to restore from.</p> <p>You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. However, you can use only the ARN to specify a DB snapshot.</p> <p>Constraints:</p> <ul> <li> <p>Must match the identifier of an existing Snapshot.</p> </li> </ul>
        engine: <p>The database engine to use for the new DB cluster.</p> <p>Default: The same as source</p> <p>Constraint: Must be compatible with the engine of the source</p>
        engine_version: <p>The version of the database engine to use for the new DB cluster.</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 name of the DB subnet group 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>
        database_name: <p>Not supported.</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 will belong to.</p>
        tags: <p>The tags to be assigned to the restored DB cluster.</p>
        kms_key_id: <p>The Amazon KMS key identifier to use when restoring an encrypted DB cluster from a DB snapshot or DB cluster snapshot.</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>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 snapshot or DB cluster snapshot in <code>SnapshotIdentifier</code> is encrypted, then the restored DB cluster is encrypted using the KMS key that was used to encrypt the DB snapshot or DB cluster snapshot.</p> </li> <li> <p>If the DB snapshot or DB cluster snapshot in <code>SnapshotIdentifier</code> is not encrypted, then the restored DB cluster is not encrypted.</p> </li> </ul>
        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 Amazon 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>
        copy_tags_to_snapshot: <p> <i>If set to <code>true</code>, tags are copied to any snapshot of the restored DB cluster that is created.</i> </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_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_snapshot_not_found_fault.DBSnapshotNotFoundFault: <p> <i>DBSnapshotIdentifier</i> does not refer to an existing DB 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_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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_neptune.types.restore_db_cluster_from_snapshot_message.RestoreDBClusterFromSnapshotMessage]",
    ) -> AsyncOperationResponse[
        "capo_neptune.types.restore_db_cluster_from_snapshot_result.RestoreDBClusterFromSnapshotResult"
    ]:
        import capo_neptune._operations.amazon_rd_sv19.restore_db_cluster_from_snapshot

        (
            output,
            http_response,
        ) = await capo_neptune._operations.amazon_rd_sv19.restore_db_cluster_from_snapshot.async_restore_db_cluster_from_snapshot(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreDBClusterFromSnapshot")
    )
    input_: capo_neptune.types.restore_db_cluster_from_snapshot_message.RestoreDBClusterFromSnapshotMessage = {}
    if availability_zones is not None:
        input_["availability_zones"] = availability_zones
    if db_cluster_identifier is not None:
        input_["db_cluster_identifier"] = db_cluster_identifier
    if snapshot_identifier is not None:
        input_["snapshot_identifier"] = snapshot_identifier
    if engine is not None:
        input_["engine"] = engine
    if engine_version is not None:
        input_["engine_version"] = engine_version
    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 database_name is not None:
        input_["database_name"] = database_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 copy_tags_to_snapshot is not None:
        input_["copy_tags_to_snapshot"] = copy_tags_to_snapshot
    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 = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output