top of page

How to integrate SpringBoot application with AWS Dynamo DB

  • Writer: Subhasish Sahu
    Subhasish Sahu
  • Apr 23, 2020
  • 1 min read

Updated: May 25, 2020


Pre - Requisite :


  1. Java 1.8 ( or above)

  2. Intellij Idea IDE

  3. WinSCP

  4. Putty and PuttyGen

  5. AWS Account


Please refer my previous blog on EC2 instance creation,putty and winscp installation and connecting it with EC2


Logon to AWS account and click on the drop down on the top right hand side




Create New Access Key






Create Database in Dynamo DB








Click on create and the add data to Dynamo DB table :










Open Intellij IDEA IDE and Compile it





Please not ,we will connect to AWS using region instead of url/endpoint and enter the accesskey and secretkey in the properties files derived as shown in the above screenshots.


Once the code is compiled.Connect to your EC2 instance and transfer the file using WinSCP


Login to the EC2 instance using putty



Run the commmand : java -jar springboot_awsdynamodb-ec2.jar


Open any browser


1) To Fetch the data which we had inserted in DB, we will use findById method which will return only single row based on the ID


Response



2) To Fetch all data, we will use findByAll method


Response



3) To insert/save single data


Use below code



Hit below url


Response:


Inserted Successfully




4) To insert/save multiple data


Use below code:



Hit the url :






Comments


bottom of page