# Key-Value Data Model

The key-value data model stores each value under a unique key so applications can retrieve, update, or delete it directly.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/key-value-data-model

> A key-value model organizes data as associations between identifiers and values rather than primarily as related tables. It is useful for access patterns such as retrieving a session, shopping cart, or user preference by identifier, and it underpins many cloud NoSQL databases and caches.

Practice exams covering Key-Value Data Model: [CLF-C02 AWS Certified Cloud Practitioner](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner), [DEA-C01 AWS Certified Data Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate), [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate).

## 6 key aspects of Key-Value Data Model

Key-value modeling combines unique record identifiers and direct access with deliberate key design, while leaving query capabilities and operational guarantees to the implementation.

1. **Unique key-based identity**: Each record is identified by a unique key within its collection or namespace. Keys may be single identifiers or composite identifiers, so applications must supply the components required to identify the intended record.
2. **Direct access by identifier**: The model is well suited to reading or changing a record when its key is already known. Sessions, shopping carts, and device state are practical examples of this access pattern.
3. **Implementation-dependent value structure**: Values may be opaque bytes or structured data with addressable attributes. Check the database's supported types and update operations rather than assuming every implementation handles values identically.
4. **Access-pattern-driven design**: Design keys and indexes around the queries the application must perform. Queries that do not align with those structures may require scans, additional indexes, or duplicated records.
5. **Partitioning and workload distribution**: Distributed implementations can use keys to place data across partitions. Distribute traffic across keys where possible, because a frequently accessed record can become a bottleneck even when overall storage is well distributed.
6. **Separate operational guarantees**: Persistence, expiration, eviction, consistency, and transactions are properties of the chosen implementation, not guarantees of the model. Distinguish an authoritative database from a cache before deciding where application state belongs.

## Cloud services for Key-Value Data Model

These services apply key-based access to different storage roles. DynamoDB can hold durable application records, while ElastiCache can cache frequently requested records to reduce repeated database reads. A cache-aside application checks ElastiCache first, reads DynamoDB on a miss, and then caches the result; it must also manage expiration and stale entries. MemoryDB offers a durable in-memory database option when its supported data structures and access patterns fit the workload. These services are alternatives or complementary components, not a required stack, and their consistency, persistence, and cost characteristics should guide selection.

- **[Amazon DynamoDB](https://blowstack.com/tools/cloud-services-hub/amazon-dynamodb)**: Amazon DynamoDB is a managed NoSQL database supporting key-value and document data models. Items are identified by a partition key or a composite partition-and-sort key, and secondary indexes support additional access patterns.
- **[Amazon ElastiCache](https://blowstack.com/tools/cloud-services-hub/amazon-elasticache)**: Amazon ElastiCache provides managed in-memory caching with engines including Valkey, Redis OSS, and Memcached. Applications use keyed entries for cached database results, sessions, and other frequently accessed data, with behavior such as expiration and eviction depending on the engine and configuration.

## Key-Value Data Model exam questions

Real practice exam questions on Key-Value Data Model, with the correct answer and its explanation.

### Question 1 (CLF-C02)

**Question:**

An online retailer needs to store shopping carts and retrieve each cart by its unique cart ID. Traffic varies sharply during promotions. The retailer wants a serverless NoSQL key-value database that provides single-digit millisecond performance without requiring database instance management. Which solution best meets these requirements?

**Correct answer:** Amazon DynamoDB with on-demand capacity

**Explanation:** Amazon DynamoDB is a serverless NoSQL database that supports key-value access and single-digit millisecond performance. On-demand capacity automatically accommodates changing request traffic without requiring database instance management or provisioned throughput planning.

### Question 2 (DEA-C01)

**Question:**

A data ingestion platform uses Amazon MemoryDB to store small configuration documents for thousands of pipelines. Each pipeline has a unique pipeline ID and uses exactly one connector type. A worker receives only a pipeline ID and must retrieve that pipeline's complete configuration with one direct lookup. An administrative process receives only a connector type and must retrieve the exact IDs of all pipelines using that connector without scanning unrelated configurations. Connector assignments can change, and the application can maintain additional lookup structures when configurations change.

Which storage design meets these access requirements?

**Correct answer:** Store each configuration under config:<pipeline-id>. Maintain a set under connector:<connector-type> containing the IDs of pipelines using that connector. Update set membership whenever a pipeline is created, deleted, or reassigned.

**Explanation:** The configuration key supports a direct lookup by pipeline ID. The connector-specific set provides an exact reverse lookup of pipeline IDs without scanning configurations. Maintaining membership as assignments change keeps this additional lookup structure aligned with the configurations.

### Question 3 (DVA-C02)

**Question:**

An IoT application stores years of sensor readings from millions of devices. Each reading contains a device ID, a timestamp that is unique for that device, and measurement attributes. The application's primary access pattern is retrieving readings for one device within a specified timestamp range. Results must include all writes that completed before the request began. The developer must select a managed data store and design an access pattern that reads only the requested key range rather than examining the device's entire history. Which solution meets these requirements?

**Correct answer:** Use an Amazon DynamoDB table with device ID as the partition key and timestamp as the sort key. Use Query with partition-key equality, a sort-key BETWEEN condition, and ConsistentRead set to true.

**Explanation:** The partition key groups each device's readings, and the sort key supports efficient timestamp-range retrieval. Query can select the requested range through its key condition. Strongly consistent reads on the base table include writes that completed before the read began.

### Question 4 (SAA-C03)

**Question:**

A company is building a user-preferences service that stores 2 GB of data. Each record is approximately 1 KB and is retrieved or updated only by its unique user ID. The application does not require joins or queries across users. Traffic averages 5,000 requests per day, with long idle periods and unpredictable bursts of up to 500 requests per second. User IDs distribute requests evenly. The service requires single-digit millisecond database response times and data replication across multiple Availability Zones. Which solution meets these requirements with the LOWEST ongoing cost?

**Correct answer:** Use an Amazon DynamoDB table with on-demand capacity mode and user ID as the partition key.

**Explanation:** The access pattern maps directly to key-based item operations. On-demand capacity charges for requests rather than continuously provisioned throughput, making it cost-effective for this low-volume workload with idle periods and unpredictable bursts. DynamoDB provides single-digit millisecond performance and automatically replicates data across multiple Availability Zones.

## Practice Key-Value Data Model in a full exam

Questions on Key-Value Data Model in each practice exam, with every answer option and an explanation for each:

- [DEA-C01](https://blowstack.com/practice-exams/aws-certified-data-engineer-associate): 4 questions
- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 3 questions
- [CLF-C02](https://blowstack.com/practice-exams/aws-certified-cloud-practitioner): 1 question
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 1 question

## What is Key-Value Data Model

The key-value data model associates a unique key with a value within a defined collection or namespace. The key identifies the record, while the value contains the application data. For example, the key cart:customer-482 might identify a shopping cart whose value contains product identifiers, quantities, and an update timestamp. The basic operations are reading, writing, and deleting data by key. The complete key must distinguish one record from another, even when it consists of multiple components.

Values can be simple strings, binary data, or structured objects, depending on the database. A basic key-value store may treat the value as opaque content that only the application interprets. More capable implementations can inspect attributes, update individual fields, or maintain indexes. Consequently, key-value does not mean that every record must contain only two scalar fields, and it does not prohibit storing a JSON-like object as the value.

Cloud applications use this model when they know how records will be requested. A web application can retrieve session data using a session token, while a device platform can retrieve the latest device state using a device identifier. Managed cloud services can distribute records across partitions using their keys and handle infrastructure tasks such as replication and capacity management. Good key design distributes requests as well as stored data; one extremely popular key can still create a hot spot.

The main trade-off is between efficient, predictable access patterns and flexible querying. Retrieving a known key is a natural operation. Finding every cart containing a particular product may require a secondary index, an additional lookup structure, or an expensive scan. Engineers should identify required queries before designing keys and indexes. Duplicating selected data across records can make reads simpler, but it also introduces additional writes and consistency responsibilities.

The model does not determine durability, consistency, or transaction support. Some implementations primarily serve as caches, where entries can expire or be evicted. Others are durable databases suitable for authoritative application data. Some offer strongly consistent reads, conditional writes, and transactions, while others expose different guarantees. For example, concurrent cart updates may require a conditional write or atomic operation to avoid one request overwriting another. These capabilities must be evaluated separately from the data model.

For AWS Certified Cloud Practitioner questions, recognize Amazon DynamoDB as a managed NoSQL database supporting key-value and document data models. It is distinct from relational database services such as Amazon RDS, which organize data into tables with relational querying capabilities. DynamoDB uses a partition key and can optionally use a sort key; together, those attributes identify an item when a composite primary key is configured. Do not assume that all NoSQL databases are key-value stores: document, graph, and wide-column models are also part of the broader NoSQL category.

## Learn Key-Value Data Model in lessons

6 short lessons on Key-Value Data Model in 3 certification courses.

- CLF-C02: Document Data Model vs Key-Value Data Model (Premium), https://app.blowstack.com/lessons/document-data-model-vs-key-value-data-model-clf-c02
- DEA-C01: Key-Value Data Model: designing for direct key access (Premium), https://app.blowstack.com/lessons/key-value-data-model-designing-for-direct-key-access-dea-c01
- SAA-C03: Document Data Model versus Key-Value Data Model (Premium), https://app.blowstack.com/lessons/document-data-model-versus-key-value-data-model-saa-c03
- CLF-C02: Key-Value Data Model: records accessed by key (Premium), https://app.blowstack.com/lessons/key-value-data-model-records-accessed-by-key-clf-c02
- SAA-C03: Relational Data Model vs Key-Value Data Model (Premium), https://app.blowstack.com/lessons/relational-data-model-vs-key-value-data-model-saa-c03
- SAA-C03: Key-Value Data Model: designing for key-based access (Premium), https://app.blowstack.com/lessons/key-value-data-model-designing-for-key-based-access-saa-c03
