Tables, Items, and Atributes
Tables, Items, and Atributes are the core components
Tables, a colletion of items.
Items, a collection of atrributes. Each item in the table has a unique identifier, or primary key, that distinguishes the item from all of the others in the table. Other than the primary key, each item can have its own distinct attributes, which means that neither the attributes nor their data types need to b e defined beforehand.
Attributes, each item is composed of one or more attributes, this is the fundamental data element. Most of the attributes are scalar, which means that they can have only one value.
DynamoDB supports two different kinds of primary keys:
- Partition Key - A simple primary key, composed of one attribute known as the partition key.
- Partiion key and sort key - Referred to as a composite primary key, composed of two attributes. The first attribute is the partition key, and the second attribute is the sort key.
- Global secondary index - An index with a partition key and sort key that can be different from those o the table.
- Local secondary index - An index that has the same partition key as the table, but a different sort key.
Each event is represented by a stream record. If you enable a stream on a table, DynamoDB Streams writes a stream record whenever one of the following events occurs:
- A new item is added to the table: The stream captures an image of the entire item, including all of its attributes.
- An item is updated: The stream captures the "before" and "after" image of any attributes that were modified in the item.
- An item is deleted from the table: The stream captures an image of the entire item before it was deleted.
Each stream record also contains the name of the table, the event timestamp, and other metadata. Stream records have a lifetime of 24 hours; after that, they are automatically removed from the stream.