Prerequisites
- Install node and npm
- Install the Serverless Framework installed with an AWS account set up.
- Install JDK and not Java JRE. Set your JAVA_HOME.
- Install Apache Maven.
- Create a free Serverless Redis database from Upstash as described here.
Project Setup
- Create the project:
-
Add jedis as dependency to the pom.xml:
- Update serverless.yml adding an http endpoint as below:
The Code
Update Handler.java as below:Deploy and Run
First build your project withmvn clean install
. Then deploy to AWS with
serverless deploy
. The last command will output the endpoint URL as below: