DynamoDB

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.
More Information
Key Conceptsโ
- Table: a collection of items
- Item: a collection of attributes (similar to a row in a relational database)
- Attribute: a fundamental data element (similar to a column)
- Primary Key: uniquely identifies each item in the table
More Information
Primary Key Typesโ
Partition Key (Simple Primary Key)โ
- A single attribute that uniquely identifies each item
- DynamoDB uses the partition key value as input to an internal hash function to determine the physical partition where the item is stored
Partition Key and Sort Key (Composite Primary Key)โ
- Two attributes: partition key and sort key
- Multiple items can have the same partition key, but they must have different sort keys
- Items with the same partition key are stored together, sorted by the sort key
- Enables efficient range queries on the sort key
More Information
Secondary Indexesโ
Global Secondary Index (GSI)โ
- An index with a partition key and optional sort key that can be different from the table's primary key
- Can be created at any time
- Queries on the index can span all partitions of the table
- Has its own provisioned throughput, separate from the table
Local Secondary Index (LSI)โ
- An index with the same partition key as the table but a different sort key
- Must be created at table creation time
- Queries are scoped to items that have the same partition key value
- Shares the table's provisioned throughput
More Information
Capacity Modesโ
On-Demandโ
- Pay-per-request pricing
- Automatically scales to accommodate workload
- No capacity planning required
- Useful for unpredictable workloads
Provisionedโ
- You specify the number of reads and writes per second
- Can use Auto Scaling to adjust capacity automatically
- More cost-effective for predictable workloads
- Free tier eligible
More Information
DynamoDB Streamsโ
- Captures a time-ordered sequence of item-level changes in a table
- Each stream record appears exactly once and in the order of the actual modifications
- Records are retained for 24 hours
- Common use cases: triggering Lambda functions, replicating data, maintaining materialized views
Global Tablesโ
- Multi-region, multi-active replication
- Automatically replicates tables across selected AWS regions
- Provides low-latency reads and writes in any region
- DynamoDB Streams must be enabled
DAX (DynamoDB Accelerator)โ
- In-memory cache for DynamoDB
- Microsecond response times for read-heavy workloads
- Fully managed and highly available
- Compatible with existing DynamoDB API calls (no application code changes required)