> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon DynamoDB

> Fully managed NoSQL key-value and document database.

## What is this integration?

Amazon DynamoDB is a fast, flexible NoSQL database service for any scale.

## What Monk manages

* Table: create, update, delete

## What the Agent can do and how to use it

* **Table Management**: Create, update, and delete DynamoDB tables with custom schemas
* **Global Tables**: Configure multi-region replication for global applications
* **Backup & Restore**: Enable point-in-time recovery and on-demand backups
* **Scaling**: Configure auto-scaling for read/write capacity (provisioned mode)
* **Streams**: Enable DynamoDB Streams for change data capture
* **TTL**: Configure time-to-live settings for automatic item expiration
* **Indexes**: Create and manage global secondary indexes (GSI) and local secondary indexes (LSI)

Steps:

1. Ensure AWS provider is added: monk cluster provider add -p aws
2. monk update \<namespace>/\<name>

## Auth

* Uses AWS provider credentials configured via monk cluster provider add -p aws

## Links

* Provider docs: [https://docs.aws.amazon.com/amazondynamodb/](https://docs.aws.amazon.com/amazondynamodb/)

## Getting Started

1. Ensure AWS provider is added:

```bash theme={null}
monk cluster provider add -p aws
```

2. Define a table (save as dynamodb.yaml):

```yaml theme={null}
namespace: aws-dynamo-db-example

simple-table:
  defines: aws-dynamo-db/dynamo-db-table
  region: us-east-1
  table_name: simple-example-table
  attribute_definitions:
    - AttributeName: id
      AttributeType: S
  key_schema:
    - AttributeName: id
      KeyType: HASH
  billing_mode: PAY_PER_REQUEST
```

3. Create/update:

```bash theme={null}
monk update aws-dynamo-db-example/simple-table
monk describe aws-dynamo-db-example/simple-table
```

## Backup & Restore Actions

DynamoDB supports **Point-in-Time Recovery (PITR)** with 35-day continuous backups and **On-Demand Backups** that are retained indefinitely.

| Action               | Description                         |
| -------------------- | ----------------------------------- |
| `get-backup-info`    | View PITR status and recent backups |
| `create-snapshot`    | Create an on-demand backup          |
| `list-snapshots`     | List available backups              |
| `describe-snapshot`  | Get detailed backup info            |
| `delete-snapshot`    | Delete an on-demand backup          |
| `restore`            | Restore to a new table              |
| `get-restore-status` | Check restore progress              |

```bash theme={null}
# View backup configuration
monk do my-app/my-table/get-backup-info

# Create an on-demand backup
monk do my-app/my-table/create-snapshot backup_name="pre-migration"

# List available backups
monk do my-app/my-table/list-snapshots

# Restore from backup to new table
monk do my-app/my-table/restore backup_arn="arn:aws:dynamodb:..." target_table="restored-table"

# Point-in-time restore (latest)
monk do my-app/my-table/restore use_latest="true" target_table="restored-table"

# Check restore status
monk do my-app/my-table/get-restore-status target_table="restored-table"
```

**Note:** DynamoDB restore always creates a **new table** - it does not overwrite the source.

### Enable PITR in Definition

```yaml theme={null}
my-table:
  defines: aws-dynamo-db/dynamo-db-table
  region: us-east-1
  table_name: production-table
  point_in_time_recovery_enabled: true  # Enable 35-day continuous backup
  deletion_protection_enabled: true
  # ... key schema ...
```
