Build Java REST API using API Gateway, AWS Lambda, DynamoDB & Serverless framework on AWS

Sash
6 min readJun 18, 2020

Prerequisites

  1. AWS account setup with AWS Access Key Id and Secret Access Key
  2. AWS CLI installed in your local machine
  3. Java installed in your local machine
  4. Install Node.js & npm on your local machine

Initial Setup

  1. Install serverless framework on your local machine by running the below npm command
    $ npm install -g serverless

2. Verify serverless installation

$ serverless -v
Framework Core: 1.71.3
Plugin: 3.6.12
SDK: 2.3.0
Components: 2.30.11

Create Serverless project

Run the below serverless command to generate serverless project using the aws-java-maven template

$ serverless create --template aws-java-maven --name serverless-restapi
Serverless: Generating boilerplate...
_______ __
| _ .-----.----.--.--.-----.----| .-----.-----.-----.
| |___| -__| _| | | -__| _| | -__|__ --|__ --|
|____ |_____|__| \___/|_____|__| |__|_____|_____|_____|
| | | The Serverless Application Framework
| | serverless.com, v1.71.3
-------'

--

--