Upstash Documentation

Using AWS SAM

1 min read
GitHub Repository

You can find the project source code on GitHub.

This tutorial implements a serverless application and deploy it to AWS Lambda using AWS SAM.

Prerequisites#

  1. Complete AWS SAM Prerequisites
  2. Install the AWS SAM CLI

Project Setup#

Create a SAM application with the following options:

Counter Function Setup#

Update /hello_world/requirements.txt to include upstash-redis:

/hello_world/requirements.txt

Update /hello_world/app.py:

/hello_world/app.py

Update /template.yaml to pass Upstash Redis environment variables:

/template.yaml

Database Setup#

Create a Redis database using Upstash Console or Upstash CLI. Copy UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN for the next steps.

Build#

Deploy#

Enter your database related environment variables when prompted.

Visit the HelloWorld API Gateway URL to see the response.