AWS DynamoDB vs DocumentDB vs Neptune
- AWS offers multiple purpose-built NoSQL database services, each optimized for different data models and access patterns.
- DynamoDB is a key-value/document database for high-scale low-latency workloads, DocumentDB is MongoDB-compatible for document workloads, and Neptune is a graph database for highly connected data.
- Choice depends on data model, query patterns, scale requirements, and existing application compatibility.
DynamoDB vs DocumentDB vs Neptune Comparison
| Feature | DynamoDB | DocumentDB | Neptune |
|---|---|---|---|
| Data Model | Key-value + Document | Document (JSON) | Graph (property graph + RDF) |
| Compatibility | AWS proprietary API | MongoDB 3.6/4.0/5.0 compatible | Gremlin, SPARQL, openCypher |
| Architecture | Serverless, fully managed | Cluster-based (primary + replicas) | Cluster-based (primary + replicas) |
| Scaling | Automatic, unlimited (horizontal) | Vertical (instance size) + read replicas (up to 15) | Vertical (instance size) + read replicas (up to 15) |
| Serverless Option | Yes (On-Demand or Provisioned) | Yes (DocumentDB Elastic Clusters) | Yes (Neptune Serverless) |
| Latency | Single-digit milliseconds | Low milliseconds | Milliseconds for traversals |
| Max Item/Document Size | 400KB | 16MB | N/A (graph edges/vertices) |
| Query Flexibility | Limited (partition key + sort key, GSI/LSI) | Rich (MongoDB query language, aggregation pipelines) | Graph traversals (multi-hop relationships) |
| Transactions | Yes (up to 100 items, 4MB) | Yes (multi-document ACID) | Yes (ACID) |
| Global Replication | Global Tables (multi-region active-active) | Global Clusters (up to 5 regions, read replicas) | Global Database (up to 5 read regions) |
| Change Streams | DynamoDB Streams / Kinesis Data Streams | Change Streams (MongoDB compatible) | Neptune Streams |
| Caching | DAX (microsecond reads) | No built-in (use ElastiCache) | No built-in (use ElastiCache) |
| Full-Text Search | No (integrate OpenSearch) | Basic text indexes | Neptune Analytics (vector + full-text) |
| Vector Search | No | No | Yes (Neptune Analytics) |
| Pricing | Per request (on-demand) or per RCU/WCU (provisioned) | Per instance-hour + storage + I/O | Per instance-hour + storage + I/O |
Amazon DynamoDB
- Fully serverless key-value and document database – single-digit millisecond latency at any scale.
- Capacity modes: On-Demand (pay per request, zero capacity planning) or Provisioned (with Auto Scaling).
- Designed for massive scale – handles 10+ trillion requests per day, peaks above 100 million requests/second.
- Global Tables – multi-region, multi-active replication with Multi-Region Strong Consistency (MRSC, GA 2025).
- DynamoDB Accelerator (DAX) – in-memory cache for microsecond read latency.
- DynamoDB Streams – capture item-level changes for event-driven processing (Lambda integration).
- TTL – automatic item expiration at no cost.
- Zero-ETL to Redshift – replicate data to Redshift for analytics without pipelines.
- Limitations: 400KB item size, limited query flexibility (must know partition key), no joins, no aggregations.
- Best for: High-scale applications with known access patterns – gaming leaderboards, session stores, IoT, e-commerce carts, serverless backends.
Amazon DocumentDB
- MongoDB-compatible document database – supports MongoDB 3.6, 4.0, and 5.0 API compatibility.
- Purpose-built storage – separates compute from storage (similar to Aurora); storage auto-scales to 128TB.
- Rich queries – full MongoDB query language, aggregation pipelines, secondary indexes, geospatial queries.
- Elastic Clusters – shard collections across multiple nodes for horizontal scaling (millions of reads/writes per second).
- Global Clusters – cross-region disaster recovery with up to 5 read regions.
- Change Streams – MongoDB-compatible change data capture for event-driven architectures.
- 16MB document size – suitable for complex nested documents.
- Not 100% MongoDB compatible – some features differ (check compatibility matrix).
- Best for: MongoDB workloads migrating to AWS, content management, catalogs, user profiles, applications needing flexible schemas with rich querying.
Amazon Neptune
- Fully managed graph database – purpose-built for storing and querying highly connected data.
- Supports three query languages: Apache TinkerPop Gremlin (property graphs), SPARQL (RDF/linked data), and openCypher (declarative graph queries).
- Neptune Analytics – analyze graph data with vector search, graph algorithms, and full-text search.
- Neptune Serverless – automatically scales compute based on workload.
- Neptune ML – machine learning predictions on graph data using GNNs (Graph Neural Networks) via SageMaker.
- Global Database – cross-region read replicas for low-latency reads and disaster recovery.
- Neptune Streams – capture graph changes for downstream processing.
- Up to 15 read replicas – scale reads across multiple instances.
- Best for: Relationship-heavy data – social networks, recommendation engines, fraud detection, knowledge graphs, network topology, identity graphs, supply chain.
When to Choose Which
- Choose DynamoDB when:
- You need extreme scale with single-digit ms latency
- Access patterns are well-defined (key-value lookups)
- You want fully serverless with zero management
- Use cases: session stores, gaming, IoT, e-commerce, serverless apps
- Choose DocumentDB when:
- You’re migrating from MongoDB or need MongoDB compatibility
- Documents are complex/nested and need flexible querying
- You need aggregation pipelines and secondary indexes
- Use cases: content management, catalogs, user profiles
- Choose Neptune when:
- Data is highly connected with complex relationships
- Queries involve traversing relationships (multi-hop)
- You need graph algorithms (shortest path, centrality, community detection)
- Use cases: social networks, fraud detection, knowledge graphs, recommendations
AWS Certification Exam Practice Questions
- A social media application needs to find “friends of friends” and recommend connections based on mutual relationships. Which database is purpose-built for this query pattern?
- DynamoDB with GSI
- DocumentDB with aggregation
- Neptune (graph traversal)
- RDS with JOIN queries
- A company is migrating a MongoDB application to AWS. They use aggregation pipelines, geospatial queries, and change streams extensively. Which service provides the best compatibility?
- DynamoDB with Document model
- DocumentDB
- Neptune
- ElastiCache for MongoDB
- A gaming application needs a leaderboard that handles 50,000 writes per second with single-digit millisecond latency, using simple key-value access patterns. Which database fits?
- DocumentDB
- Neptune
- Aurora
- DynamoDB
- A fraud detection system needs to analyze transaction patterns by traversing relationships between accounts, devices, IP addresses, and merchants to find suspicious clusters. Which database is best suited?
- DynamoDB with Streams
- DocumentDB with aggregation
- Neptune with graph algorithms
- Redshift for analytics
- An e-commerce application stores product catalogs with deeply nested attributes (variations, specifications, reviews) and needs to query by any attribute with aggregation. Documents average 2MB. Which database fits?
- DynamoDB (400KB limit would be exceeded)
- DocumentDB (16MB limit, rich queries)
- Neptune
- S3 with Athena
Related Posts
- AWS Aurora vs RDS – MySQL & PostgreSQL
- AWS Database Services Cheat Sheet
- AWS SQS vs SNS vs EventBridge
- AWS Certified Solutions Architect – Associate Exam Learning Path
References
Amazon DynamoDB Developer Guide