Local Dynamodb using Docker on Mac

Felix Gondwe
Nov 19, 2020

We will cover how to get dynamodb running in your local environment using docker. Using Mac so the scope is limited to this operating system, should work on Linux too but only tested on a Mac.

Macbook pro | macOS Catalina

This covers a use case where you’re interested in persisting data when your container stops for instance. It could also be useful in a situation where you’re interested in migrating your data somewhere else, new laptop for example.

Requirements

  • Make sure you have docker installed. If not follow this link to see how to set it up.
  • Install a simple dynamodb GUI by running below. This assumes you have node installed in your mac. If not use this link to set it up.
$ npm install -g dynamodb-admin

Steps

  • Open two terminals. One for docker and the other for the GUI
  • create docker-compose.yml file and copy the following snippet.
  • Run the following command to start the container
$ docker-compose up
  • Now that you have docker container running. Let’s see it in the GUI. Switch to the second terminal and run the following
$ export DYNAMO_ENDPOINT="http://localhost:8000"$  dynamodb-admin
after running dynamodb-admin

That’s it! Happy coding :-)

Summary

  1. Install dynamodb-admin
  2. Copy docker-compose.yml file
  3. Start the container
  4. Start dynamo-db GUI

--

--