Local Dynamodb using Docker on Mac
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
- Now go to your favorite browser and type: http://localhost:8000
That’s it! Happy coding :-)
Summary
- Install dynamodb-admin
- Copy docker-compose.yml file
- Start the container
- Start dynamo-db GUI