🏠 Back to Blog
- Fully managed, highly available with replication across AZs
- NoSQL Database
- Scales to massive workloads, highly distributed database
- Fully integrates with IAM
- Enable event driven programming with DynamoDB streams
- DynamoDB is made of tables
- Each table will have primary key (must be decided at creation time)
- Each table can have an infinite number of rows (rows are items)
- Each row can have a max of 400KB of data
- how to choose a primary key?
- Two types of primary keys
- partition keys
- Partition key must be unique for each item
- Partition key must be ‘diverse’ so that data is distributed
- partition key + sort key
- data is grouped by partition key
- each combination must be unique per item
- Provisioned Mode
- Provision all capacity in advance by providing values for RCU and WCU
- Pay up front
- Throughput can temporarily be exceeded using a burst capacity
- If you exhaust the burst capacity, you can retry using exponential backoff
- On-demand Mode
- Reads/writes scale on-demand
- Pay for what you use
- You can switch between the two modes once every 24 hours
- Alternate sort key for your table
- Must be defined at table creation time
- Up to 5 local secondary indexes per table
- The sort key consists of one scaler attribute (string, number, or binary)
- Alternative primary key from the base table
- Use SQL-like syntax to query DynamoDB tables
- DynamoDB has a feature called “conditional writes” to ensure an item has not changed before writing to it
- Each item has an attribute that acts as a version number
- Useful for when you have multiple writers attempters to write to an item
- Fully managed, highly available, seamless in-memory cache for DynamoDB
- Microseconds latency for cached reads and queries
- Does not require that you change any application code
- Solves the “hot key” problem. If you read a specific key (item) too many times, you may get throttled.
- 5 minutes TTL for cache (default)
- Up to 10 DAX nodes per cluster
- Multi-AZ (3 nodes minimum recommended for production)
- Secure (Encryption in transit and at rest)
- Streams are an ordered item-level modifications (create/update/delete) in a table
- Stream records can be:
- Sent to Kinesis Data Streams
- Read by AWS Lambda
- Read by Kinesis Client Library Apps
- Data retention for up to 24 hours
- Use cases:
- react to changes in real-time
- Analytics
- Insert into derivative tables
- Insert into OpenSearch service