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.