Over a million developers have joined DZone.

Using AWS Java SDK with AWS DynamoDB

· Performance Zone

Discover 50 of the latest mobile performance statistics with the Ultimate Guide to Digital Experience Monitoring, brought to you in partnership with Catchpoint.

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 GIThere.

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:
Screen Shot 2013-06-18 at 13.23.16
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:
Screen Shot 2013-06-19 at 14.54.49

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.

Is your APM strategy broken? This ebook explores the latest in Gartner research to help you learn how to close the end-user experience gap in APM, brought to you in partnership with Catchpoint.

Topics:

Published at DZone with permission of Pascal Alma, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}