Amazon DynamoDB Integration
This article helps any new developer who wants to connect to Amazon DynamoDB — keep reading to find out more!
Join the DZone community and get the full member experience.Join For Free
This article helps any new developer who wants to connect to Amazon DynamoDB.
- Developer should have working IDE
- The developer should have an AWS account and have DynamoDb service added.
- A sample DynamoDb Table to be created.
In your class-path, you should have awsconfiguration.json created. For android, these files should reside in the project folder -> res/raw folder.
Below are sample code-snippet
Note: Masked PoolId, AppClientId in the above snippet, the developer can get these details in his AWS account when he created CognitoIdentity Pool.
Code to Connect DynamoDb:
The required dependencies needed to be added to the grade or maven file. Below are sample dependencies needed to be added in Gradle:
Once all the above code and configurations are met, we can test the code with a sample data ingestion. Below is a sample code-snippet for ingesting into the Amazon DynamoDb table.
You have to convert your object model to Document which is basically followed by Key-value and then the call ingest method.
Once we run, you can check the data in the Amazon DynamDB table. Sample screenshot.
You are now good to go. Happy learning!
Opinions expressed by DZone contributors are their own.