2016
09
December

Develop Locally – Use DynamoDB Local!

DynamoDB is Amazon’s version of a NoSQL database. Now normally like everyone in the Amazon web space you have to develop your application remotely… and every developer knows that developing remotely is a huge pain. Not only do you have to worry about network and speed issues, you also have to worry about racking up unnecessary costs developing DynamoDB. Amazon charges depending on how much space, network bandwidth etc, you use. Your application isn’t even in production!!! Up until recently, using DynamoDB was no exception. But now you have DynamoDB Local!

DynamoDB Local is a fully functional, self-contained version of Amazon’s DynamoDB NoSQL database. It runs entirely on your local machine and does not require any of kind of internet connection to Amazon. The best part is you don’t get charged for transactions you run using the local version of DynamoDB. This keeps development costs way down. You can develop your application, run speed and load tests all the time without having to worry about being charged for the bandwidth. It really is the best of both worlds. You get to use a high-quality NoSQL database that will be situated in the cloud and you can do full testing on your application BEFORE you release to AWS.

Getting started with DynamoDB Local is very simple. Go to Amazon’s website and download the DynamoDB Local executable and install it along with the latest version of the JDK. Now you just run the command below to bring up the database.

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb -port 8888

This will start open DynamoDB on your machine at port 8888. Now to access the DynamoDB console, just go to http://localhost:8888/shell

The only difference here is the DynamoDB Local interface is a JavaScript shell. There are not any easy buttons to list tables or create tables like DynamoDB on AWS. Still, the interface is pretty intuitive. A screenshot is below:

dynamodb_screen_1

You can look up commands using the JavaScript shell using the the second button on the right and it will take expand the commands you can run such as Creating, Updating and List Tables and Creating, Updating and Removing items in these tables. You just copy the command and paste it into the window above and that’s it! You are not manipulating data and tables in your own DynamoDB database and it isn’t costing you a thing!

Now that you have a local DynamoDB running on your local development environment, you can use Amazon’s Java API for DynamoDB to write your application to work with DynamoDB. To make it even easier, there is also a Spring community version for DynamoDB which allows you some JPA support. Now I will warn you that support for JPA is not very robust. I ran into several issues using it. There were a few things that were just not supported. Keep in mind this a community version and so support for things is much slower. I ended up with the normal Java API developed by Amazon to use some of the more advanced features I needed in order to complete my application.

Welcome to the wonderful world of local development using DynamoDB. Enjoy!

Share with your peeps...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Tagged with: , , , , — Posted in Software Development

Leave a Reply