Amazon DynamoDB is a fully managed NoSQL database designed for high performance, scalability, and low-latency access to large datasets. While DynamoDB is primarily offered as a cloud service on AWS, developers often need a local development environment to test schemas, queries, and integrations without incurring cloud costs. In this blog we’ll learn how to install DynamoDB Local on Ubuntu.
Why Use DynamoDB Local?
DynamoDB Local is ideal for:
- Offline development and testing
- Faster iteration without AWS latency
- Experimenting with table design and queries
- CI/CD pipelines and local automation
It behaves similarly to the real DynamoDB service but runs entirely on your local machine.
Step 1: Update the System
Before installing anything, ensure your system packages are up to date:
sudo apt update
sudo apt upgrade
Step 2: Install Java (OpenJDK 17)
DynamoDB Local requires Java. Install OpenJDK 17:
sudo apt install openjdk-17-jdk
Verify the installation:
java -version
You should see output confirming Java 17 (or higher) is installed.
Step 3: Create a Directory for DynamoDB Local
Create a dedicated directory to store DynamoDB Local files:
mkdir ~/dynamodb
cd ~/dynamodb
Step 4: Download DynamoDB Local
Download the latest version directly from Amazon:
wget https://s3.us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.tar.gz
Extract the archive:
tar -xvzf dynamodb_local_latest.tar.gz
Step 5: Run DynamoDB Local
Start DynamoDB Local using the following command:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
What this does:
- Runs DynamoDB on port 8000
- Uses a shared database file (-sharedDb)
- Keeps everything local to your machine
Leave this terminal running while DynamoDB is in use.
Step 6: Install AWS CLI (If Not Installed)
To interact with DynamoDB Local, you’ll need the AWS CLI.
sudo apt install awscli
Configure it:
aws configure
You can enter placeholder values for credentials and region—DynamoDB Local does not require real AWS credentials.
Step 7: Verify DynamoDB Is Running
Open a new terminal and run:
aws dynamodb list-tables --endpoint-url http://localhost:8000
If DynamoDB Local is running correctly, you’ll see:
{
"TableNames": []
}
Step 8: Create a Test Table
Let’s create a simple table to confirm everything works:
aws dynamodb create-table \
--table-name Users \
--attribute-definitions AttributeName=UserID,AttributeType=S \
--key-schema AttributeName=UserID,KeyType=HASH \
--provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5 \
--endpoint-url http://localhost:8000
Verify the table creation:
aws dynamodb list-tables --endpoint-url http://localhost:8000
You should now see:
{
"TableNames": ["Users"]
}
Step 9: Run DynamoDB Local as a Background Service
To have DynamoDB Local run automatically at boot, create a systemd service.
Create the Service File
sudo nano /etc/systemd/system/dynamodb.service
Add the following configuration (adjust the username and paths if needed):
[Unit]
Description=DynamoDB Local
After=network.target
[Service]
ExecStart=/usr/bin/java -Djava.library.path=/home/ubuntu/dynamodb/DynamoDBLocal_lib \
-jar /home/ubuntu/dynamodb/DynamoDBLocal.jar -sharedDb
Restart=always
User=ubuntu
[Install]
WantedBy=multi-user.target
Enable and Start the Service
sudo systemctl enable dynamodb
sudo systemctl start dynamodb
Check the service status:
sudo systemctl status dynamodb
Conclusion
successfully installed and configured DynamoDB Local on Ubuntu server. This setup provides a fast, reliable, and cost-free environment for developing and testing DynamoDB-based applications before deploying them to AWS.
Whether you’re building microservices, testing data models, or running local CI pipelines, DynamoDB Local is a powerful tool every AWS developer should have. For any further assistance related to How to Install DynamoDB Local on Ubuntu, or if you face challenges while configuring, troubleshooting, or optimizing your local AWS DynamoDB setup, feel free to reach out to us. Our team of experts provides reliable Server Management Services, ensuring smooth installation, secure configuration, and efficient performance for your development and production environments.