Lesson 5 of 5 Operational and Purpose-Built Databases

Choosing Purpose-Built Databases for Particular Data Shapes

This lesson explains the AWS databases built for particular data shapes and access patterns, how to recognise when a scenario calls for one, and how to get data in and out of it.

Learning outcomes

After completing this lesson, you will be able to:

  • Match data models to purpose-built databases.
  • Recognise the signals in a question that point to a database.
  • Move data from operational stores to analytics.

Which database for which shape

AWS offers specialised databases for particular data models. The following table describes the data model of each and when it should be chosen.

DatabaseData modelChoose when
Amazon KeyspacesWide-column, Apache Cassandra compatible (CQL)Migrating Cassandra workloads; serverless, high-scale key-based access
Amazon NeptuneGraph (Gremlin, openCypher, SPARQL)Relationships are the query: fraud rings, recommendations, knowledge graphs
Amazon DocumentDBJSON documents, MongoDB compatibleMigrating MongoDB applications; flexible nested documents
Amazon OpenSearch ServiceSearch indexFull-text search, log analytics, vector search
Amazon MemoryDBDurable in-memory key-value (Valkey/Redis compatible)Microsecond reads with durability as a primary database
Amazon ElastiCacheIn-memory cacheCaching in front of another database; session stores

The following diagram shows the fraud question as a graph traversal.

The fraud question as a graph. Accounts, devices, cards and addresses are vertices, and shared use is an edge. A Gremlin or openCypher traversal from a known fraudster follows up to four hops to find linked accounts in milliseconds, where a relational database would need four self-joins over very large tables.
The vertices are illustrative.
Match the pairs

Specialised databases

Exam skills 2.1.3

Match each requirement with the specialised database.

Log in to try this activity Interactive activities are free with an account.

Signals in the question

Exam questions often contain a phrase that points to a particular data store. "Existing Cassandra application with minimal code changes" points to Amazon Keyspaces, which is compatible with Cassandra. "Find connections several hops away", such as friends of friends or fraud rings, points to Amazon Neptune, because a relational database would need many self-joins.

"MongoDB drivers" or "MongoDB compatibility" points to Amazon DocumentDB. "Search by keywords with relevance ranking" or "semantic similarity" points to Amazon OpenSearch Service, or another vector store for semantic search.

Moving data to analytics

Operational databases are designed to serve applications, not heavy analytics, and analytical queries against them slow down the applications that depend on them. Data is therefore moved into analytics stores, and each specialised database has its own paths.

Data can be exported or captured with change data capture (CDC) into Amazon S3: AWS DMS supports Amazon DocumentDB as a source, and Amazon Keyspaces and Amazon Neptune offer exports and change streams. Amazon OpenSearch Ingestion pipelines load data into OpenSearch from S3, Kinesis or DynamoDB. Where they are available, zero-ETL integrations replicate data continuously with no pipeline to build.

True or false

Specialised data to analytics

Exam skills 2.1.5

Decide whether each statement is true.

Log in to try this activity Interactive activities are free with an account.
Worked example

A payments company wants to find accounts linked to known fraudsters through shared devices, cards and addresses, up to four connections away, and to answer each query in under a second.

The relationships are the query, so this is a graph problem for Amazon Neptune: accounts, devices, cards and addresses become vertices, shared use becomes edges, and a Gremlin or openCypher traversal follows up to four hops in milliseconds. A relational database would need four self-joins over very large tables, and DynamoDB has no traversal capability.

Check yourself

Which database suits queries that follow relationships across several hops?

Show answer

Amazon Neptune, a graph database.

Exam Tips

Remember for the exam

  • Keyspaces for Cassandra workloads; DocumentDB for MongoDB workloads.
  • Neptune when relationships and multi-hop traversals are the core queries.
  • OpenSearch for full-text, log and vector search.
  • MemoryDB is a durable in-memory database; ElastiCache is a cache.
  • Move data to the lake with exports, CDC or zero-ETL rather than querying operational stores.