Reader small image

You're reading from  DynamoDB Cookbook

Product typeBook
Published inSep 2015
Publisher
ISBN-139781784393755
Edition1st Edition
Concepts
Right arrow
Author (1)
Tanmay Deshpande
Tanmay Deshpande
author image
Tanmay Deshpande

Tanmay Deshpande is a Hadoop and big data evangelist. He currently works with Schlumberger as a Big Data Architect in Pune, India. He has interest in a wide range of technologies, such as Hadoop, Hive, Pig, NoSQL databases, Mahout, Sqoop, Java, cloud computing, and so on. He has vast experience in application development in various domains, such as oil and gas, finance, telecom, manufacturing, security, and retail. He enjoys solving machine-learning problems and spends his time reading anything that he can get his hands on. He has great interest in open source technologies and has been promoting them through his talks. Before Schlumberger, he worked with Symantec, Lumiata, and Infosys. Through his innovative thinking and dynamic leadership, he has successfully completed various projects. He regularly blogs on his website http://hadooptutorials.co.in. You can connect with him on LinkedIn at https://www.linkedin.com/in/deshpandetanmay/. He has also authored Mastering DynamoDB, published in August 2014, DynamoDB Cookbook, published in September 2015, Hadoop Real World Solutions Cookbook-Second Edition, published in March 2016, Hadoop: Data Processing and Modelling, published in August, 2016, and Hadoop Blueprints, published in September 2016, all by Packt Publishing.
Read more about Tanmay Deshpande

Right arrow

Downloading and setting up DynamoDB Local


A call to any cloud resource may cost money to you, even if you are just doing development and not talking about any hosting in the production cluster. During development, we may need to try many things, and all those trials would cost us. The development best practices demand us to follow a test-driven development. For continuous integration and builds, it's good to run unit tests and integration tests to make sure that the build is intact. If we keep running unit tests and integration tests on the actual DynamoDB, we may end up paying a lot. To cater to this issue, we have something called as DynamoDB Local.

DynamoDB Local is a small client-side database and server that mimics the actual DynamoDB. It enables you to develop and test your code in the local environment, without modifying anything on the actual DynamoDB. It is compatible with the actual DynamoDB API, so there is no need to worry about duplicating your efforts.

Getting ready

DynamoDB Local is a Java Archive (JAR) file, which will run on the Windows, Mac, or Linux machines. To execute these APIs, you should have Java Runtime Engine (JRE) 6.0+ installed on your machine. You can refer to following docs to install JRE on your machine:

For Windows 64-bit machine: http://www.oracle.com/technetwork/java/javase/install-windows-64-142952.html.

For Windows 32-bit machine: http://www.oracle.com/technetwork/java/javase/install-windows-141940.html.

For Mac: http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jre.html.

How to do it…

You can download DynamoDB Local from the following locations:

Now, let's perform the following steps to install DynamoDB Local:

  1. Once done, just unzip the .jar file, and save it in a folder.

  2. Now use Command Prompt, go to the folder where you have unzipped the .jar file, and execute the following command:

    java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar
    

    You will see the jetty server getting started at http://localhost:8000:

  3. Now you can use this as an endpoint for your development. For example, if we want to use it in the Java SDK, we can use this as follows:

    client = new AmazonDynamoDBClient(credentials);
    client.setEndpoint("http://localhost:8000");

    We will see more of its uses in the following chapters.

How it works…

DynamoDB Local is a simple .jar file that runs on your local machine and mimics the actual DynamoDB. You can do your development using DynamoDB, test your code, and simply redirect to the actual DynamoDB whenever it is ready for production deployment. Even though DynamoDB Local mimics most of the DynamoDB features, it does not support some important ones, which are as follows:

  • It does not consider the provisioned throughput settings while making any calls.

  • It does not throttle the read or write activity. The CreateTable, UpdateTable, and DeleteTable operations occur immediately. The table state is always ACTIVE.

  • It does not keep track of the consumed capacity units. So, it always returns null instead of the actual capacity units.

  • Read operations in DynamoDB are eventually consistent, but due to the speed of DynamoDB Local, it appears to be strongly consistent.

There's more…

The DynamoDB Local .jar gives you various other options in addition in order to manage DynamoDB Local smoothly. Here are some more options:

The -help function will list all the options available with DynamoDB Local JAR, as shown in the following command:

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar – help

The output is shown in the following command:

Previous PageNext Page
You have been reading a chapter from
DynamoDB Cookbook
Published in: Sep 2015Publisher: ISBN-13: 9781784393755
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Tanmay Deshpande

Tanmay Deshpande is a Hadoop and big data evangelist. He currently works with Schlumberger as a Big Data Architect in Pune, India. He has interest in a wide range of technologies, such as Hadoop, Hive, Pig, NoSQL databases, Mahout, Sqoop, Java, cloud computing, and so on. He has vast experience in application development in various domains, such as oil and gas, finance, telecom, manufacturing, security, and retail. He enjoys solving machine-learning problems and spends his time reading anything that he can get his hands on. He has great interest in open source technologies and has been promoting them through his talks. Before Schlumberger, he worked with Symantec, Lumiata, and Infosys. Through his innovative thinking and dynamic leadership, he has successfully completed various projects. He regularly blogs on his website http://hadooptutorials.co.in. You can connect with him on LinkedIn at https://www.linkedin.com/in/deshpandetanmay/. He has also authored Mastering DynamoDB, published in August 2014, DynamoDB Cookbook, published in September 2015, Hadoop Real World Solutions Cookbook-Second Edition, published in March 2016, Hadoop: Data Processing and Modelling, published in August, 2016, and Hadoop Blueprints, published in September 2016, all by Packt Publishing.
Read more about Tanmay Deshpande