Run DynamoDB on your local host

In a recent post we explained how to use Amazon Web Services for free until some limits are exceeded. But if you are not/no longer eligible for AWS Free tier program or you want to develop even when you don’t have Internet connections, we also have good news for you: for some services, there are implementations that can be launched on your local host and after that they simulates the behaviour of a real AWS service.

One example we are going to investigate in this post is DynamoDB Local. The name it’s quite self-explanatory: a mock for DynamoDB that can run locally, without any cost, without having Internet connection. It is an official implementation, support being offered by AWS team. This means also that new features added in DynamoDB are also faster replicated into this package. The official page is available here and from there you can download an archive.

If you use a UNIX operating system, these are 3 commands you have to run to start DynamoDB Local.

Note: java is required.

tar -xvzf dynamodb_local_latest.tar.gz 
java -jar DynamoDBLocal.jar -port 8888

If anything goes fine – and it should do – you’ll have the local version of DynamoDB running on port 8888.

If you open the address http://localhost:8888/shell/ in your favorite browser, you’ll get a page like this:

This page offers you a JavaScript shell where you can run commands to handle DynamoDB resources: tables and data. The left section is the actual shell, whereas the right column contains documentation paragraphs and commands examples that can be copied and run in the left section. Maybe this library is not perfect and not all the features are covered, but it’s a good start and with several possible workarounds and few configurations, it can integrated into your application.

As always, we invite you to read more in the official documentation and to share your feedback with us in a comment. Also, if you know someone that could find this article useful, send him the link!