Skip to content

create_serverless_cache_snapshot

create_serverless_cache_snapshot(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_snapshot_name: Optional[String] = None,
    serverless_cache_name: Optional[String] = None,
    kms_key_id: Optional[String] = None,
    tags: Optional[TagList] = None,
) -> CreateServerlessCacheSnapshotResponse

This API creates a copy of an entire ServerlessCache at a specific moment in time. Available for Valkey, Redis OSS and Serverless Memcached only.

Parameters:

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

    The name for the snapshot being created. Must be unique for the customer account. Available for Valkey, Redis OSS and Serverless Memcached only. Must be between 1 and 255 characters. This value is stored as a lowercase string.

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

    The name of an existing serverless cache. The snapshot is created from this cache. Available for Valkey, Redis OSS and Serverless Memcached only.

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

    The ID of the KMS key used to encrypt the snapshot. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL

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

    A list of tags to be added to the snapshot resource. A tag is a key-value pair. Available for Valkey, Redis OSS and Serverless Memcached only.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def create_serverless_cache_snapshot(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_snapshot_name: Optional[
        "capo_elasticache.types.string.String"
    ] = None,
    serverless_cache_name: Optional["capo_elasticache.types.string.String"] = None,
    kms_key_id: Optional["capo_elasticache.types.string.String"] = None,
    tags: Optional["capo_elasticache.types.tag_list.TagList"] = None,
) -> "capo_elasticache.types.create_serverless_cache_snapshot_response.CreateServerlessCacheSnapshotResponse":
    """<p>This API creates a copy of an entire ServerlessCache at a specific moment in time. Available for Valkey, Redis OSS and Serverless Memcached only.</p>

    Args:
        serverless_cache_snapshot_name: <p>The name for the snapshot being created. Must be unique for the customer account. Available for Valkey, Redis OSS and Serverless Memcached only. Must be between 1 and 255 characters. This value is stored as a lowercase string.</p>
        serverless_cache_name: <p>The name of an existing serverless cache. The snapshot is created from this cache. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        kms_key_id: <p>The ID of the KMS key used to encrypt the snapshot. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL</p>
        tags: <p>A list of tags to be added to the snapshot resource. A tag is a key-value pair. Available for Valkey, Redis OSS and Serverless Memcached only.</p>

    Raises:
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_serverless_cache_state_fault.InvalidServerlessCacheStateFault: <p>The account for these credentials is not currently active.</p>
        capo_elasticache.errors.serverless_cache_not_found_fault.ServerlessCacheNotFoundFault: <p>The serverless cache was not found or does not exist.</p>
        capo_elasticache.errors.serverless_cache_snapshot_already_exists_fault.ServerlessCacheSnapshotAlreadyExistsFault: <p>A serverless cache snapshot with this name already exists. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.serverless_cache_snapshot_quota_exceeded_fault.ServerlessCacheSnapshotQuotaExceededFault: <p>The number of serverless cache snapshots exceeds the customer snapshot quota. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The specified service linked role (SLR) was not found.</p>
        capo_elasticache.errors.tag_quota_per_resource_exceeded.TagQuotaPerResourceExceeded: <p>The request cannot be processed because it would cause the resource to have more than the allowed number of tags. The maximum number of tags permitted on a resource is 50.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.create_serverless_cache_snapshot_request.CreateServerlessCacheSnapshotRequest]",
    ) -> OperationResponse[
        "capo_elasticache.types.create_serverless_cache_snapshot_response.CreateServerlessCacheSnapshotResponse"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.create_serverless_cache_snapshot

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.create_serverless_cache_snapshot.create_serverless_cache_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateServerlessCacheSnapshot")
    )
    input_: capo_elasticache.types.create_serverless_cache_snapshot_request.CreateServerlessCacheSnapshotRequest = {}
    if serverless_cache_snapshot_name is not None:
        input_["serverless_cache_snapshot_name"] = serverless_cache_snapshot_name
    if serverless_cache_name is not None:
        input_["serverless_cache_name"] = serverless_cache_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