Using AWS Java SDK with AWS DynamoDB
Join the DZone community and get the full member experience.
Join For Free
in this post i show the steps i took to have a look at
aws dynamodb
by using the
java sdk
with
intellij idea
. i know it might be easier to go with
the eclipse sdk
but since i am loving my intellij idea i wanted to see how far i could get with it.
the first step is to get the sdk. i took the sources from the
git
here
.
i opened the (
maven
) project in intellij and unfortunately saw that my build was failing. i had to disable the gpg signing and increase the heap size used by maven by adding a few arguments to the maven command:
with these arguments in place the build succeeded.
next step i created a new maven project and added the class i found
here
to create and fill a few tables that are used for several demonstrating purposes as described in the
dynamodb developers guide
.
after making some small changes to the script it ran successfully. i had to change the loading of the properties file so it could actually find the supplied awscredentials.properties file. the other change was setting the region of the client to ‘eu-west’ like this:
client.setregion(com.amazonaws.regions.region.getregion(regions.eu_west_1));
after running the class you can view the resulting tables in the dynamodb management console:
when the tables and their content are created we can fire some queries. there are some sample queries in java for this specific dataset
here
. i created another class with this code and executed it. please don’t forget the adjust the region if you created your tables in another region then the default one (us_east).
the result of running the class should be:
printing item after retrieving it.... isbn s=[111-1111111111] id n=[101] authors ss=[[author1]] title s=[book 101 title] replydatetime s=[2013-06-05t14:45:19.169z] message s=[dynamodb thread 1 reply 2 text] postedby s=[user b]
of course this only scratched the surface of all the stuff dynamodb has to offer but it is a start. from here you can prcoeed with all the other interesting things .
Published at DZone with permission of $$anonymous$$. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
From On-Prem to SaaS
-
SRE vs. DevOps
-
Exploratory Testing Tutorial: A Comprehensive Guide With Examples and Best Practices
-
Structured Logging
Comments