Amazon DynamoDB is a fully managed NoSQL database service that provides fast, predictable performance and seamless scalability.
Basic structure
DynamoDB has a few core concepts: tables, items, and attributes. A table is a collection of items, and each item is a collection of attributes. You can think of them as the equivalent of collections, documents, and fields in MongoDB.
Primary keys in DynamoDB
Unlike MongoDB, DynamoDB does not generate an _id by default to uniquely identify a record. That is why DynamoDB has the concept of a primary key. You specify the primary key of a table, and the primary key uniquely identifies each item in the table (by designating one attribute as the primary key).
DynamoDB supports two kinds of primary keys:
1. Partition key
DynamoDB uses the value of the partition key as the input to an internal hash function. The output of the hash function determines the partition where the item is stored (the physical storage inside DynamoDB).
2. Composite primary key (partition key and sort key)
DynamoDB uses the partition key value as the input to an internal hash function. The output of the hash function determines the partition where the item is stored (the physical storage inside DynamoDB). All items with the same partition key are stored together, sorted by the sort key value.
In a table with a partition key and a sort key, two items may have the same partition key value, but they must have different sort key values.