• Subhasish Sahu

How to integrate SpringBoot application with AWS Dynamo DB

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

https://www.thesubhasishsahu.com/post/how-to-deploy-springboot-application-on-aws-ec2-instance-and-retrieve-key-value-pair-from-aws-secret


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 :









Download source code from GITHUB: https://github.com/subhasish23sahu/springboot-awsdynamodb-ec2


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 :






93 views0 comments