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

# DynamoDB 存储

Agno 支持使用 `DynamoDbStorage` 类，将 DynamoDB 作为 Agent、Team 和 Workflow 的存储后端。

## 用法

您需要为 `DynamoDbStorage` 类提供 `aws_access_key_id` 和 `aws_secret_access_key` 参数。

```python dynamodb_storage_for_agent.py theme={null}
from agno.storage.dynamodb import DynamoDbStorage

# AWS 凭证
AWS_ACCESS_KEY_ID = getenv("AWS_ACCESS_KEY_ID")
AWS_SECRET_ACCESS_KEY = getenv("AWS_SECRET_ACCESS_KEY")

storage = DynamoDbStorage(
    # 将 session 存储在 ai.sessions 表中
    table_name="agent_sessions",
    # region_name: DynamoDB 区域名称
    region_name="us-east-1",
    # aws_access_key_id: AWS 访问密钥 ID
    aws_access_key_id=AWS_ACCESS_KEY_ID,
    # aws_secret_access_key: AWS 秘密访问密钥
    aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
)

# 将存储添加到 Agent
agent = Agent(storage=storage)
```

## 参数

<Snippet file="storage-dynamodb-params.mdx" />

## 开发者资源

* 查看 [Cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/storage/dynamodb_storage/dynamodb_storage_for_agent.py)
