Installation

Unlike other packages, lambda_cache was designed to operate specifically within an AWS Lambda Function. Hence the installation is slightly more complicated.

There are two general options to using it.

Manual Installation

Because lambda-cache is a pure python package, you can manually include it in your lambda function, like so:

$ pip install lambda-cache -t /path/to/function

Once installed you will see the following directory structure in your lambda function via the console:

Installed Package

Using Serverless Framework

Using Serverless Framework, and the serverless-python-requirements plugin, you can include any python package, including simple_lambda_cache into your lambda function.

simply ensure that simple_lambda_cache is part of your requirements.txt file:

$ pip install lambda-cache

Using the publicly available layer from Klayers

Klayers is a project that publishes AWS Lambda Layers for public consumption. A Lambda layer is way to pre-package code for easy deployments into any Lambda function.

You can 'install' lambda_cache by simply including the latest layer arn in your lambda function.

For now include any of the following arns as layers in your package, replacing , with your region of choice (e.g. 'ap-southeast-1','us-east-1', etc.)

arn:aws:lambda::770693421928:layer:Klayers-python38-lambda-cache:1