1 Serverless Project Setup
If you do not have it already, install serverless framework via:
npm install -g serverless
In any folder run serverless as below:
See Using AWS SAM, if you prefer AWS SAM
over Serverless Framework.
serverless.yml as below. Copy your Redis URL from console and
replace below:
For the best performance choose the same region for your Lambda function and
Upstash database.
2 Create a Redis (Upstash) Database
Create a database from Upstash console
3 Code
Edit handler.js and replace your REDIS_URL below.
This example uses ioredis, you can copy the connection string from the
Node tab in the console.