dynamodb
**DynamoDB** is a **fully managed NoSQL database by AWS providing microsecond latency and infinite scalability** — handling any scale of data and traffic automatically without managing servers, making it ideal for serverless applications and high-traffic systems.
**What Is DynamoDB?**
- **Type**: Fully managed NoSQL (key-value and document).
- **Performance**: Microsecond latency at any scale.
- **Scaling**: Automatic, infinite scaling (no capacity planning).
- **Serverless**: No servers to manage, pay-per-request or provisioned.
- **Consistency**: Eventual or strong consistency options.
**Why DynamoDB Matters**
- **Automatic Scaling**: Handles traffic spikes without intervention.
- **Serverless**: Pairs perfectly with Lambda, API Gateway.
- **Global Tables**: Multi-region replication with active-active.
- **Low Latency**: Microsecond reads/writes at scale.
- **No Ops**: AWS manages backups, durability, encryption.
- **Cost-Effective**: Pay only for capacity used.
**Key Features**
**Primary Key Design**: Partition key + sort key for efficient access.
**Global Secondary Indexes**: Query different attribute combinations.
**Streams**: Changes trigger Lambda for real-time processing.
**TTL**: Auto-delete old items (perfect for sessions, caches).
**Transactions**: ACID transactions across items.
**Quick Start**
```python
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('Users')
# Write
table.put_item(Item={'user_id': '123', 'name': 'John'})
# Read
response = table.get_item(Key={'user_id': '123'})
# Query
response = table.query(
KeyConditionExpression='user_id = :id',
ExpressionAttributeValues={'id': '123'}
)
```
**Use Cases**
Mobile apps, real-time dashboards, sessions, leaderboards, recommendations, IoT data, user profiles.
DynamoDB is the **serverless database of choice** — automatic scaling and microsecond latency make it perfect for modern applications.