AWS DynamoDB Introduction (original) (raw)

Last Updated : 4 Feb, 2026

DynamoDB allows users to create databases capable of storing and retrieving any amount of data, and comes in handy while serving any amount of traffic. It dynamically manages each customer's requests and provides high performance by automatically distributing data and traffic over servers.

Core Architecture: Tables, Items, and Attributes

DynamoDB organizes data in a hierarchy:

  1. **Table: A collection of data. (Equivalent to a Table in SQL).
  2. **Item: A single record in the table. (Equivalent to a Row in SQL).
  3. **Attribute: A single data element in an item. (Equivalent to a Column in SQL).

The Primary Key: Partition Key Vs Sort Key

The most critical design decision in DynamoDB is your Primary Key. It determines how data is stored and queried. There are two types:

**Partition Key (Simple Primary Key):

**Partition Key + Sort Key (Composite Primary Key):

Secondary Indexes: LSI Vs GSI

What if you want to query by a field that isn't your primary key (e.g., finding a user by Email instead of UserID)? You use Secondary Indexes.

**Feature **Local Secondary Index (LSI) **Global Secondary Index (GSI)
**Creation Must be created at table creation time. Cannot be added later. Can be created or deleted at any time.
**Key Schema Same Partition Key as base table, different Sort Key. Different Partition Key and/or different Sort Key.
**Scope Queries are scoped to a single partition (e.g., "Find orders for User 123"). Queries can span the entire table (e.g., "Find user with email X").
**Scaling Shares throughput capacity with the base table. Has its own independent throughput capacity.

Note: Most modern applications prefer GSIs because they are more flexible and scalable. LSIs are rarely used in new designs due to their limitations.

Capacity Modes: On-Demand Vs Provisioned

DynamoDB offers two pricing models that dictate how it scales.

**Feature **On-Demand Mode **Provisioned Mode
**Best For Unpredictable traffic, new apps, dev/test environments. Predictable, steady traffic, massive scale with cost optimization.
**Scaling Automatic. Scales instantly to accommodate thousands of requests per second. Manual or Auto-Scaling. You define Read/Write Capacity Units (RCU/WCU).
**Pricing Pay-per-request (Higher unit cost, but zero waste). Pay-per-hour for reserved capacity (Lower unit cost if fully utilized).
**Throttling Rare (only during massive, instant bursts). Possible if traffic exceeds provisioned limits.

Advanced Features

1. DynamoDB Streams

2. Global Tables

3. DynamoDB Accelerator (DAX)

DynamoDB Vs RDBMS: A Quick Comparison

**Feature **DynamoDB (NoSQL) **RDBMS (SQL)
**Schema Flexible (Schema-less). Rigid (Fixed Schema).
**Scaling Horizontal (Unlimited storage/throughput). Vertical (Hard to scale write throughput).
**Querying Optimized for Key-Value lookups. No JOINs. Powerful SQL (JOINs, Aggregations).
**Transactions ACID support (Multi-item transactions). ACID support (Standard).
**Cost Model Pay for storage + requests (IO). Pay for instance uptime (Server).

Limitations of DynamoDB

The below list provides us with the limitations of Amazon DynamoDB: