DocumentDB, Neptune and Keyspaces
Amazon DocumentDB for MongoDB workloads, Amazon Neptune for graphs and Neptune Streams, and Amazon Keyspaces for Apache Cassandra.
Purpose-built NoSQL databases
DynamoDB isn't the only NoSQL database on AWS. Three more each copy a popular open-source data model, so existing applications and skills move over with little change:
- DocumentDB for MongoDB (documents);
- Neptune for graphs;
- Keyspaces for Apache Cassandra (wide-column tables).
Amazon DocumentDB
Aurora is AWS's own implementation of PostgreSQL and MySQL. Amazon DocumentDB (with MongoDB compatibility) is the same idea for MongoDB.
- MongoDB is a NoSQL database that stores, queries and indexes JSON documents. Each document can have its own fields and nested data.
- DocumentDB works with the same MongoDB drivers, code and tools.
- It's deployed like Aurora: a cluster with a primary and up to 15 replicas, over a storage volume replicated across three AZs.
- Fully managed and highly available.
- Storage grows automatically in 10 GB steps, up to 128 TiB (256 TiB on engine version 8.0 and later).
- Elastic clusters scale out to workloads with millions of requests per second and petabytes of data.
Use it for: content management, product catalogues and user profiles stored as JSON, and any app already written for MongoDB.
Amazon Neptune
Amazon Neptune is a fully managed graph database. A graph stores nodes (people, posts, comments) and edges (the relationships between them: friends with, posted, likes, wrote).
A social network is the classic graph: users have friends, posts have comments, comments have likes from users, users share and like posts. Questions such as "friends of friends who liked this post" take many joins in a relational database but are natural in a graph.
- Highly available across three AZs, with up to 15 read replicas.
- Built for highly connected data and complex queries over it: it stores billions of relationships and queries the graph in milliseconds.
- Query languages: Gremlin and openCypher (property graphs) and SPARQL (RDF graphs).
Use it for: knowledge graphs (like Wikipedia), fraud detection (rings of linked accounts and cards), recommendation engines and social networking.
Neptune Streams
Neptune Streams is a real-time, ordered record of every change to the graph data.
- Changes are available immediately after they're written.
- No duplicates and strict order.
- The stream is read through an HTTP REST API, for example from an application on EC2 or a scheduled Lambda function.
- Use cases:
- send notifications when certain changes happen;
- keep a copy of the graph in another store, such as S3, OpenSearch or ElastiCache;
- replicate data across Regions in Neptune.
Amazon Keyspaces (for Apache Cassandra)
Apache Cassandra is an open-source, distributed NoSQL wide-column database, built for huge amounts of data and heavy write traffic. Amazon Keyspaces is a managed, Cassandra-compatible service.
- Serverless, scalable, highly available and fully managed. Tables scale up and down automatically with traffic.
- Tables are replicated three times across AZs.
- It uses the Cassandra Query Language (CQL) and existing Cassandra drivers.
- Single-digit millisecond latency at any scale, thousands of requests per second and more.
- Capacity: on-demand or provisioned with auto scaling, like DynamoDB.
- Encryption, backups, and point-in-time recovery up to 35 days.
Use it for: storing IoT device information, time-series data, and moving existing Cassandra workloads off self-managed clusters.
Real-world examples
- A publisher's CMS is built on MongoDB. Moving to DocumentDB keeps the code and removes the work of running MongoDB replica sets.
- A bank loads accounts, cards, devices and transactions into Neptune and looks for unusual rings of shared devices to catch fraud.
- A telecom company runs a 30-node Cassandra cluster for device events. Keyspaces replaces it, with no servers to patch and capacity that follows the traffic.
Exam tips
- "MongoDB", "JSON documents", "MongoDB compatible" → DocumentDB.
- "Graph", "relationships", "social network", "knowledge graph", "fraud rings", "recommendations" → Neptune.
- "Change events from a graph database" → Neptune Streams.
- "Apache Cassandra", "CQL" → Keyspaces.
- "Serverless NoSQL with no particular open-source API" → DynamoDB.
Common traps
- "DocumentDB is open-source MongoDB." It's AWS's own engine that speaks the MongoDB API.
- "Use DynamoDB for deep relationship queries." Many-hop relationship queries are what Neptune is for.
- "Keyspaces needs you to size Cassandra nodes." It's serverless; there are no nodes.
Check yourself
DocumentDB and Neptune bill for cluster instances by the hour, and they need a client inside the VPC to try them, so instead of a lab:
Amazon DocumentDB: it's MongoDB-compatible, so the app keeps its drivers and queries, and AWS runs a cluster with replicas across three AZs.
Amazon Neptune: the shared details form a graph, and following the links between claims, people and accounts is a fast graph query.
Amazon Keyspaces: Cassandra-compatible, uses CQL, serverless with on-demand or provisioned capacity.
AWS documentation
DynamoDB advanced
DAX caching, DynamoDB Streams and Kinesis Data Streams, global tables, time to live, point-in-time recovery and on-demand backups, and export to and import from S3.
Amazon Timestream
What a time series database is for, Timestream's features and architecture, and the move from Timestream for LiveAnalytics to Timestream for InfluxDB.