Local Development with DynamoDB, Setup and Usage Guide.

Shahabaj S. Shaikh
3 min readOct 22, 2023

--

DynamoDB Local is the best way to develop and test your applications without incurring AWS costs or requiring an internet connection.

Make sure, Java Runtime Environment (JRE) version 8.x or newer is required for running DynamoDB locally.

Download and install Dynamodb.

You can download DynamoDB locally from the AWS website as below.

and at the end of setup, you will get the below screenshot that needs to be up in a separate terminal window.

There are two major ways to interact with Dynamodb

  • CLI
  • Dynamodb workbench

1. CLI

  • Create a table in the local DynamoDB
/> aws dynamodb create-table --table-name sample --attribute-definitions AttributeName=Name,AttributeType=S AttributeName=city,AttributeType=S --key-schema AttributeName=Name,KeyType=HASH AttributeName=city,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 --table-class STANDARD --endpoint-url http://localhost:8000
  • List the created tables in local DynamoDB.
/> aws dynamodb list-tables --endpoint-url http://localhost:8000
  • Put/insert the item to create a local DynamoDB table.
/> aws dynamodb put-item --table-name sample --item "{\"Name\":{\"S\":\"Ali\"},\"city\":{\"S\":\"Mumbai\"}}" --endpoint-url http://localhost:8000
  • Scan the DynamoDB table items.
/> aws dynamodb scan --table-name sample --endpoint-url http://localhost:8000
{
"Items": [
{
"city": {
"S": "Mumbai"
},
"Name": {
"S": "Ali"
}
}
],
"Count": 1,
"ScannedCount": 1,
"ConsumedCapacity": null
}
  • Execute query on the local DynamoDB table.
/> aws dynamodb execute-statement --statement "SELECT * FROM sample WHERE city='Mumbai'" --endpoint-url http://localhost:8000
{
"Items": [
{
"city": {
"S": "Mumbai"
},
"Name": {
"S": "Ali"
}
}
]
}

2. DynamoDB Workbench.

The tool helps developers, architects, and database administrators design and query data models for applications using Amazon DynamoDB, which is a popular NoSQL database service provided by Amazon Web Services (AWS).

  1. Download NoSQL Workbench and DynamoDB locally.

You can download and install DynamoDB Workbench from the AWS Management Console or directly from the below link.

2. Set up a connection with local DynamoDB.

Once Workbench has been installed, open it and first set up a connection with local as below screen.

Click on Operation builder > Add connection

After clicking on ‘Add connection’ you will get a prompt window that asks you, three mandatory details Connection Name, host name and port you need to fill in accordingly. Take reference to the below screenshot.

Once filled in all the details click on Connect to create a connection.

3. View and Manage Tables:

You can view your existing DynamoDB tables and create new ones from the Workbench interface and/or perform operations on the table.

The below screenshot will help you to select a table to view and manage its data.

Note: The exact steps and options may vary slightly depending on the version of the tool and any updates that have been made.

--

--

Shahabaj S. Shaikh

Cloud Developer, Solution Architect with RevOps | Serverless | Python