Skip to content

create_snapshot

create_snapshot(
    cluster_name: String,
    snapshot_name: String,
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
    kms_key_id: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> CreateSnapshotResponse

Creates a copy of an entire cluster at a specific moment in time.

Parameters:

  • cluster_name (String) –

    The snapshot is created from this cluster.

  • snapshot_name (String) –

    A name for the snapshot being created.

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

    The ID of the KMS key used to encrypt the snapshot.

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

    A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

Raises:

Source code in docs_src/capo_memorydb/_services/memory_db.py
def create_snapshot(
    self,
    cluster_name: "capo_memorydb.types.string.String",
    snapshot_name: "capo_memorydb.types.string.String",
    *,
    config_overrides: Optional[MemoryDBClientConfig] = None,
    kms_key_id: Optional["capo_memorydb.types.string.String"] = None,
    tags: Optional["capo_memorydb.types.tag_list.TagList"] = None,
) -> "capo_memorydb.types.create_snapshot_response.CreateSnapshotResponse":
    """<p>Creates a copy of an entire cluster at a specific moment in time.</p>

    Args:
        cluster_name: <p>The snapshot is created from this cluster.</p>
        snapshot_name: <p>A name for the snapshot being created.</p>
        kms_key_id: <p>The ID of the KMS key used to encrypt the snapshot.</p>
        tags: <p>A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.</p>

    Raises:
        capo_memorydb.errors.cluster_not_found_fault.ClusterNotFoundFault: <p>The specified cluster does not exist.</p>
        capo_memorydb.errors.invalid_cluster_state_fault.InvalidClusterStateFault: <p>The cluster is not in a valid state for the requested operation.</p>
        capo_memorydb.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>The specified parameter combination is not valid.</p>
        capo_memorydb.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The specified parameter value is not valid.</p>
        capo_memorydb.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The required service-linked role was not found.</p>
        capo_memorydb.errors.snapshot_already_exists_fault.SnapshotAlreadyExistsFault: <p>A snapshot with the specified name already exists.</p>
        capo_memorydb.errors.snapshot_quota_exceeded_fault.SnapshotQuotaExceededFault: <p>The request cannot be processed because it would exceed the maximum number of snapshots allowed.</p>
        capo_memorydb.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would exceed the maximum number of tags allowed per resource.</p>
        capo_memorydb.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_memorydb.types.create_snapshot_request.CreateSnapshotRequest]",
    ) -> OperationResponse[
        "capo_memorydb.types.create_snapshot_response.CreateSnapshotResponse"
    ]:
        import capo_memorydb._operations.amazon_memory_db.create_snapshot

        output, http_response = (
            capo_memorydb._operations.amazon_memory_db.create_snapshot.create_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSnapshot")
    )
    input_: capo_memorydb.types.create_snapshot_request.CreateSnapshotRequest = {
        "cluster_name": cluster_name,
        "snapshot_name": snapshot_name,
    }
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    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