Did you know? You can work with AWS DynamoDB on your local machine. Yes, that’s right. In this article, we are going to set up DynamoDB locally. There are a couple of ways to do this.

Having this local version helps you save on throughput, data storage, and data transfer fees. In addition, you don’t need an internet connection while you develop your application.

Let’s get started.

Option 1. Using executable .jar file

The downloadable version of Amazon DynamoDB is provided as an executable .jar file. The application runs on Windows, Linux, macOS, and other platforms that support Java.

After download, extract the content and run the DynamoDB using the following command:

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

Before you can access DynamoDB programmatically or through the AWS Command Line Interface (AWS CLI), you must configure your credentials to enable authorization for your applications. Downloadable DynamoDB requires any credentials to work, as shown in the following example.

AWS Access Key ID: "fakeMyKeyId"
AWS Secret Access Key: "fakeSecretAccessKey"

You can use $aws configure command to set up the credentials.

Now you can access your local DynamoDB using APIs. For e.g to list local dynamodb tables:

aws dynamodb list-tables --endpoint-url http://localhost:8000

#aws #serverless #database #dynamodb

Setting up DynamoDB in a Local Dev Environment
2.00 GEEK