Install Prerequisites

Pre-requisites

Deploy Application microservice Lambda and create DynamoDB table

Below steps will create following resources in your AWS Account

  • S3 Bucket to store all the artifacts
  • AWS Lambda function implementing the Application microservice methods including the business logic
  • Amazon DynamoDB Table to store Application JSON documents

The source code of the repository is written and built using Java8 runtime. You will need to install Java8:

  • Amazon Correto 8 (an Open JDK download) OR Oracle JDK 8 (download)

To build and deploy the service manually from your machine, you will also need to install and configure Maven, and AWS CLI

  • Maven references (download and install)
  • AWS CLI references (install and configure)
  • jq (sudo yum install jq)

Versions

The project only builds and runs on Java8. If you have other versions of Java, you will need to download the configure Java8.

The minimum version requirement for AWS CLI is 1.16.84. If you have an older version of AWS CLI, you will need to upgrade it.

  • Build

Clone the source code from this GitHub repository Run the following commands to build the source code:

mvn clean test

The command above will compile the code and run unit tests

  • Package

The AWS resources used in the service are defined in SAM (AWS Serverless Application Model) templates. You can install the service into your own AWS account by packaging and deploying the SAM template template.yaml under sam/app folder.

To package the SAM templates, first you will need an S3 bucket to store the artifacts such as your AWS Lambda function code. AWS CloudFormation will use the artifacts from the S3 bucket for deployment. If you don’t have an S3 bucket yet, you can run the following command to create an S3 bucket:

aws s3 mb s3://<your bucket name>

Then run the following maven command to package the templates:

mvn clean package -DpackageBucket=<your bucket name>

The command generates a packaged-template.yaml file under folder target/sam/app. The packaged template is now deployable to AWS CloudFormation.

  • Deploy

Run the following AWS CLI command to deploy the packaged templates to your AWS account:

aws cloudformation deploy --template-file target/sam/app/packaged-template.yaml --capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND --stack-name <your-stack-name>