It is common for developers to be developing products which use and interact with several cloud-based products and services. However, developers don’t necessarily want to be permanently connected to the internet or even necessarily want to incur additional costs while developing or even just taking the time to learn how to utilize all the functionality that is at their disposal.
It makes sense for developers to be able to download and install a version of the product so they can install and learn how to use the product. The primary objective for developers will too simulate a production environment to debug and test in a disconnected manner.
Although LocalStack, A fully functional local AWS cloud stack, is available and fairly easy to use. I wanted to set up an isolated DynamoDB environment so I could learn how to leverage it in a project.
What is DynamoDB
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database so that you don’t have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling. Also, DynamoDB offers encryption at rest, which eliminates the operational burden and complexity involved in protecting sensitive dat.
With DynamoDB, you can create database tables that can store and retrieve any amount of data, and serve any level of request traffic. You can scale up or scale down your tables’ throughput capacity without downtime or performance degradation, and use the AWS Management Console to monitor resource utilization and performance metrics.
What DynamoDB Local
DynamoDB Local is a downloadable version of DynamoDB that lets you write and test applications without accessing the DynamoDB web service, instead, it is self-contained on your computer.
When you’re ready to deploy your application in production, you can make a few minor changes to the code so that it uses the DynamoDB web service.
Having this local version helps you save on provisioned throughput, data storage, and data transfer fees. In addition, you don’t need an internet connection while you’re developing your application.
DynamoDB local is available as a download, as an Apache Maven dependency, or as a Docker image.
How to Install DynamoDB Local on your Ubuntu Workstation
I wanted to do some development on my new System76 Darter Pro so I could develop on the move. DynamoDb Local is very easy to install and set up but I made some additional tweaks to make it even easier for myself.
The following is the set of Bash commands I use:
We are now already to use DynamoDb locally, if you open the README.txt using nano i.e.
nano README.TXT the instructions and command to start running DynanmoDB are contained within.
It is simply the case of running the following command
Which will respond with
You can now open your browser and visit
ttp://localhost:8000/shell. The following will be displayed
How to create terminal shortcut for dynamodb on Ubuntu
This is great, but if you’re anything like me you are going to have difficulty remembering the full command. So you’ll want and need to create something that is a little easier to remember. Fortunately, one of the great things about Linux is that it provides you the flexibility to customize your commands.
open your Bash Profile using nano
Then add the following function to your bashrc content.
Save and exit from the file then refresh your terminal window
Now you can start the your DynamoDB local instance in the terminal window by simply
We now have a local copy of DynamoDB installed which we can use for development purposes. We have also taken the time to create a memorable shortcut so we don’t have to destroy brain cells to remember the long winded command to get DynamoDB running.