You are viewing a free preview of this lesson.
Subscribe to unlock all 10 lessons in this course and every other course on LearningBro.
What is DynamoDB
What is DynamoDB
Amazon DynamoDB is a fully managed NoSQL database service provided by Amazon Web Services (AWS). It delivers single-digit millisecond performance at any scale, making it one of the most popular choices for modern, high-throughput applications.
A Brief History
- 2007 — Amazon publishes the landmark Dynamo paper, describing a highly available key-value store
- 2012 — AWS launches DynamoDB as a fully managed service inspired by the Dynamo paper
- 2013 — Local secondary indexes and fine-grained access control are added
- 2017 — DynamoDB Global Tables, Auto Scaling, and on-demand backups are introduced
- 2018 — On-demand capacity mode launches, removing the need to pre-provision throughput
- 2019 — DynamoDB Transactions provide ACID guarantees across multiple items
- 2020 — Export to S3 and PartiQL (SQL-compatible query language) are added
- Today — DynamoDB powers millions of requests per second for customers such as Amazon, Netflix, Lyft, and Capital One
What is NoSQL?
Traditional relational databases (RDBMS) store data in tables with fixed schemas, use SQL for queries, and prioritise consistency (ACID transactions). NoSQL databases take a different approach:
| Feature | Relational (SQL) | DynamoDB (NoSQL) |
|---|---|---|
| Schema | Fixed, pre-defined columns | Flexible, each item can have different attributes |
| Query language | SQL | API calls, PartiQL (SQL-compatible) |
| Scaling | Vertical (bigger server) | Horizontal (add more partitions) |
| Consistency | Strong by default | Eventually consistent by default, strong optional |
| Joins | Native JOIN operations | No joins — denormalise data instead |
| Transactions | Full ACID | ACID across up to 100 items |
DynamoDB is classified as a key-value and document database. Each item is identified by a primary key and can store structured, semi-structured, or nested data using JSON-like attributes.
Why Choose DynamoDB?
1. Fully Managed
DynamoDB removes all operational burden:
- No servers to provision, patch, or maintain
- No software installation or cluster management
- Automatic storage allocation — tables grow as needed
- Built-in monitoring via Amazon CloudWatch
2. Performance at Scale
DynamoDB is designed for consistent, single-digit millisecond latency:
- Handles more than 10 trillion requests per day
- Scales seamlessly from 1 request per second to millions
- SSD-backed storage for fast reads and writes
3. High Availability and Durability
- Data is automatically replicated across three Availability Zones within an AWS Region
- 99.999% availability SLA for Global Tables
- 99.99% availability SLA for single-region tables
- Continuous backups with point-in-time recovery (up to 35 days)
4. Flexible Data Model
- No fixed schema — each item can have different attributes
- Supports scalar types (String, Number, Binary), document types (List, Map), and set types
- Nested attributes up to 32 levels deep
- Maximum item size of 400 KB
5. Serverless and Event-Driven
DynamoDB integrates naturally with serverless architectures:
- AWS Lambda triggers via DynamoDB Streams
- API Gateway for building REST APIs backed by DynamoDB
- Step Functions for orchestrating workflows
- No connection pooling needed — uses HTTP API calls
Common Use Cases
| Use Case | Why DynamoDB? |
|---|---|
| Web and mobile applications | Low latency, auto-scaling, flexible schema |
| Gaming leaderboards | Fast reads/writes, atomic counters |
| IoT data ingestion | Millions of writes per second |
| Session management | TTL for automatic session expiry |
| E-commerce shopping carts | High availability, conditional writes |
| Real-time analytics | DynamoDB Streams with Lambda processing |
| Content management | Flexible schema for varied content types |
| Ad tech | Millisecond response times at massive scale |
How DynamoDB Compares
| Feature | DynamoDB | MongoDB (Atlas) | Cassandra | Redis |
|---|---|---|---|---|
| Managed | Fully | Fully (Atlas) | Self or managed | Fully (ElastiCache) |
| Data model | Key-value + document | Document | Wide column | Key-value |
| Max item size | 400 KB | 16 MB | 2 GB (partition) | 512 MB |
| Consistency | Eventual + strong | Strong + causal | Tunable | Strong (single node) |
| Scaling | Automatic | Manual sharding | Manual ring | Cluster mode |
| Serverless mode | Yes | Yes | No | No |
| Transactions | Yes (up to 100 items) | Yes | Lightweight | Yes (single shard) |
Getting Started
You can interact with DynamoDB using:
- AWS Management Console — web-based GUI
- AWS CLI — command-line interface
- AWS SDKs — Python (boto3), JavaScript, Java, Go, .NET, and more
- PartiQL — SQL-compatible query language
- DynamoDB Local — downloadable version for development and testing
Creating a Table (AWS CLI)
```bash
aws dynamodb create-table
--table-name Users
--attribute-definitions
AttributeName=UserId,AttributeType=S
--key-schema
AttributeName=UserId,KeyType=HASH
--billing-mode PAY_PER_REQUEST
```
This creates a table called `Users` with a partition key `UserId` (String) using on-demand billing.
Summary
DynamoDB is a fully managed, serverless NoSQL database that delivers single-digit millisecond performance at any scale. It eliminates operational overhead, scales horizontally, and replicates data across multiple Availability Zones for high availability. Its flexible data model, event-driven integration, and pay-per-use pricing make it an excellent choice for modern applications. In the next lesson, we will explore DynamoDB's core concepts — tables, items, attributes, and primary keys.