Member-only story
Revolutionize Your Rails App with DynamoDB: Unleash Speed and Scalability!
When developing a new service, we realized that a core model would be well-suited for storage in DynamoDB, Amazon’s fast and scalable NoSQL solution.

Why DynamoDB?
In my experience, when developing apps, the data primarily shown to users is often kept in a separate structure than the underlying database. Users rarely need to see raw data; they prefer summaries, denormalized representations, and charts. For our existing service, Zonmaster, we store user-facing data in an Elasticsearch database, which has served us well. However, for a new project, we wanted to explore alternative options, and that’s where DynamoDB comes into play.
What is DynamoDB?
To quote Amazon:
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. DynamoDB also offers encryption at rest, which eliminates the operational burden and complexity involved in protecting sensitive data.
In essence, DynamoDB is an optimized NoSQL database that is fully managed.
Getting Started
The first step, of course, is to set up DynamoDB for development.
Personally, I prefer using Docker Compose to manage my database elements, such as MySQL, Redis, Elasticsearch, etc. Fortunately, there’s a Docker image available for a local version of DynamoDB, making it easy to run in a development environment. Here’s what my docker-compose.yml looks like:
Here’s what my docker-compose.yml
looks like:
version: "3.7"
services:
dynamodb:
image: amazon/dynamodb-local
ports:
- ${DYNAMODB_PORT}:8000
command: ["-jar", "DynamoDBLocal.jar", "-sharedDb"]
mysqldb:
image: mysql:8.0
container_name: zmrm_mysql
volumes:
…