# Dynamodb

AWS DynamoDB NoSQL database for scalable data storage.

- Repository: https://github.com/itsmostafa/aws-agent-skills (1171 stars)
- Category: Design
- License: MIT
- Last updated: 2026-10-26
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add itsmostafa/aws-agent-skills --skill dynamodb -g -a claude-code -y`
Codex: `npx skills add itsmostafa/aws-agent-skills --skill dynamodb -g -a codex -y`
Cursor: `npx skills add itsmostafa/aws-agent-skills --skill dynamodb -g -a cursor -y`
Gemini CLI: `npx skills add itsmostafa/aws-agent-skills --skill dynamodb -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add itsmostafa/aws-agent-skills`

## Description

AWS DynamoDB NoSQL database for scalable data storage. Use when designing table schemas, writing queries, configuring indexes, managing capacity, implementing single-table design, or troubleshooting performance issues.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# AWS DynamoDB

Amazon DynamoDB is a fully managed NoSQL database service providing fast, predictable performance at any scale. It supports key-value and document data structures.

## Table of Contents

- [Core Concepts](#core-concepts)
- [Common Patterns](#common-patterns)
- [CLI Reference](#cli-reference)
- [Best Practices](#best-practices)
- [Troubleshooting](#troubleshooting)
- [References](#references)

## Core Concepts

### Keys

| Key Type | Description |
|----------|-------------|
| **Partition Key (PK)** | Required. Determines data distribution |
| **Sort Key (SK)** | Optional. Enables range queries within partition |
| **Composite Key** | PK + SK combination |

### Secondary Indexes

| Index Type | Description |
|------------|-------------|
| **GSI (Global Secondary Index)** | Different PK/SK, separate throughput, eventually consistent |
| **LSI (Local Secondary Index)** | Same PK, different SK, shares table throughput, strongly consistent option |

### Capacity Modes

| Mode | Use Case |
|------|----------|
| **On-Demand** | Unpredictable traffic, pay-per-request |
| **Provisioned** | Predictable traffic, lower cost, can use auto-scaling |

## Common Patterns

### Create a Table

**AWS CLI:**

```bash
aws dynamodb create-table \
  --table-name Users \
  --attribute-definitions \
    AttributeName=PK,AttributeType=S \
    AttributeName=SK,AttributeType=S \
  --key-schema \
    AttributeName=PK,KeyType=HASH \
    AttributeName=SK,KeyType=RANGE \
  --billing-mode PAY_PER_REQUEST
```

**boto3:**

```python
import boto3

dynamodb = boto3.resource('dynamodb')

table = dynamodb.create_table(
    TableName='Users',
    KeySchema=[
        {'AttributeName': 'PK', 'KeyType': 'HASH'},
        {'AttributeName': 'SK', 'KeyType': 'RANGE'}
    ],
    AttributeDefinitions=[
        {'AttributeName': 'PK', 'AttributeType': 'S'},
        {'AttributeName': 'SK', 'AttributeType': 'S'}
    ],
    BillingMode='PAY_PER_REQUEST'
)

table.wait_until_exists()
```

The rest: https://github.com/itsmostafa/aws-agent-skills/blob/HEAD/skills/dynamodb/SKILL.md
