Skip to content

restore_cluster_from_snapshot

restore_cluster_from_snapshot(
    cluster_name: str,
    snapshot_arn: str,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    vpc_security_group_ids: Optional[StringList] = None,
    subnet_ids: Optional[StringList] = None,
    kms_key_id: Optional[str] = None,
    tags: Optional[TagMap] = None,
    shard_capacity: Optional[int] = None,
    shard_instance_count: Optional[int] = None,
) -> RestoreClusterFromSnapshotOutput

Restores an elastic cluster from a snapshot.

Parameters:

  • cluster_name (str) –

    The name of the elastic cluster.

  • snapshot_arn (str) –

    The ARN identifier of the elastic cluster snapshot.

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

    A list of EC2 VPC security groups to associate with the elastic cluster.

  • subnet_ids (Optional[StringList], default: None ) –

    The Amazon EC2 subnet IDs for the elastic cluster.

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

    The KMS key identifier to use to encrypt the new Amazon DocumentDB elastic clusters cluster.

    The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key.

    If an encryption key is not specified here, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.

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

    A list of the tag names to be assigned to the restored elastic cluster, in the form of an array of key-value pairs in which the key is the tag name and the value is the key value.

  • shard_capacity (Optional[int], default: None ) –

    The capacity of each shard in the new restored elastic cluster.

  • shard_instance_count (Optional[int], default: None ) –

    The number of replica instances applying to all shards in the elastic cluster. A shardInstanceCount value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.

Raises:

Source code in docs_src/capo_docdb_elastic/_services/doc_db_elastic.py
def restore_cluster_from_snapshot(
    self,
    cluster_name: str,
    snapshot_arn: str,
    *,
    config_overrides: Optional[DocDBElasticClientConfig] = None,
    vpc_security_group_ids: Optional[
        "capo_docdb_elastic.types.string_list.StringList"
    ] = None,
    subnet_ids: Optional["capo_docdb_elastic.types.string_list.StringList"] = None,
    kms_key_id: Optional[str] = None,
    tags: Optional["capo_docdb_elastic.types.tag_map.TagMap"] = None,
    shard_capacity: Optional[int] = None,
    shard_instance_count: Optional[int] = None,
) -> "capo_docdb_elastic.types.restore_cluster_from_snapshot_output.RestoreClusterFromSnapshotOutput":
    """<p>Restores an elastic cluster from a snapshot.</p>

    Args:
        cluster_name: <p>The name of the elastic cluster.</p>
        snapshot_arn: <p>The ARN identifier of the elastic cluster snapshot.</p>
        vpc_security_group_ids: <p>A list of EC2 VPC security groups to associate with the elastic cluster.</p>
        subnet_ids: <p>The Amazon EC2 subnet IDs for the elastic cluster.</p>
        kms_key_id: <p>The KMS key identifier to use to encrypt the new Amazon DocumentDB elastic clusters cluster.</p> <p>The KMS key identifier is the Amazon Resource Name (ARN) for the KMS encryption key. If you are creating a cluster using the same Amazon account that owns this KMS encryption key, you can use the KMS key alias instead of the ARN as the KMS encryption key.</p> <p>If an encryption key is not specified here, Amazon DocumentDB uses the default encryption key that KMS creates for your account. Your account has a different default encryption key for each Amazon Region.</p>
        tags: <p>A list of the tag names to be assigned to the restored elastic cluster, in the form of an array of key-value pairs in which the key is the tag name and the value is the key value.</p>
        shard_capacity: <p>The capacity of each shard in the new restored elastic cluster.</p>
        shard_instance_count: <p>The number of replica instances applying to all shards in the elastic cluster. A <code>shardInstanceCount</code> value of 1 means there is one writer instance, and any additional instances are replicas that can be used for reads and to improve availability.</p>

    Raises:
        capo_docdb_elastic.errors.access_denied_exception.AccessDeniedException: <p>An exception that occurs when there are not sufficient permissions to perform an action.</p>
        capo_docdb_elastic.errors.conflict_exception.ConflictException: <p>There was an access conflict.</p>
        capo_docdb_elastic.errors.internal_server_exception.InternalServerException: <p>There was an internal server error.</p>
        capo_docdb_elastic.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be located.</p>
        capo_docdb_elastic.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The service quota for the action was exceeded.</p>
        capo_docdb_elastic.errors.throttling_exception.ThrottlingException: <p>ThrottlingException will be thrown when request was denied due to request throttling.</p>
        capo_docdb_elastic.errors.validation_exception.ValidationException: <p>A structure defining a validation exception.</p>
        capo_docdb_elastic.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_docdb_elastic.types.restore_cluster_from_snapshot_input.RestoreClusterFromSnapshotInput]",
    ) -> OperationResponse[
        "capo_docdb_elastic.types.restore_cluster_from_snapshot_output.RestoreClusterFromSnapshotOutput"
    ]:
        import capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.restore_cluster_from_snapshot

        output, http_response = (
            capo_docdb_elastic._operations.chimera_db_lionfish_service_lambda.restore_cluster_from_snapshot.restore_cluster_from_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RestoreClusterFromSnapshot")
    )
    input_: capo_docdb_elastic.types.restore_cluster_from_snapshot_input.RestoreClusterFromSnapshotInput = {
        "cluster_name": cluster_name,
        "snapshot_arn": snapshot_arn,
    }
    if vpc_security_group_ids is not None:
        input_["vpc_security_group_ids"] = vpc_security_group_ids
    if subnet_ids is not None:
        input_["subnet_ids"] = subnet_ids
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if tags is not None:
        input_["tags"] = tags
    if shard_capacity is not None:
        input_["shard_capacity"] = shard_capacity
    if shard_instance_count is not None:
        input_["shard_instance_count"] = shard_instance_count

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