Backup, import, and export
CreateBackupDeleteBackupDescribeBackupDescribeExportDescribeImportExportTableToPointInTimeImportTableListBackupsListImportsRestoreTableToPointInTime
AWS JSON protocol forms, operation inventory, and Query grammar.
Reference
The DynamoDB-compatible endpoint accepts AWS JSON protocol requests. In the local preview harness, enable it with MTS_LOCAL_DDB_BASE_PORT.
export MTS_LOCAL_CLUSTER_NAME=preview-ddb
export MTS_LOCAL_LEASE_BACKEND=file
export MTS_LOCAL_DDB_BASE_PORT=8000
bash scripts/local-cluster.sh start
Use endpoint URL http://127.0.0.1:8000, region us-east-1, and any non-empty local credentials on the file-backed dev profile.
curl -X POST "http://127.0.0.1:8000/" \
-H "Content-Type: application/x-amz-json-1.0" \
-H "X-Amz-Target: DynamoDB_20120810.Query" \
-d '{
"TableName": "Docs",
"KeyConditionExpression": "tenant = :tenant and begins_with(id, :prefix)",
"ExpressionAttributeValues": {
":tenant": {"S": "tenant-alpha"},
":prefix": {"S": "doc-"}
},
"Limit": 25
}'
{
"TableName": "Docs",
"Item": {
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-1"},
"title": {"S": "Refund policy"}
},
"ReturnConsumedCapacity": "TOTAL"
}
{
"TableName": "Docs",
"Key": {
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-1"}
},
"ProjectionExpression": "tenant, id, title",
"ConsistentRead": true
}
{
"TableName": "Docs",
"Key": {
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-1"}
},
"UpdateExpression": "SET title = :title",
"ExpressionAttributeValues": {
":title": {"S": "Updated refund policy"}
},
"ReturnValues": "ALL_NEW"
}
Query requires equality on the table or index hash key. The optional sort-key predicate may be equality, comparison, BETWEEN, or begins_with for string/binary sort keys.
{
"TableName": "Docs",
"IndexName": "tenant_category_idx",
"KeyConditionExpression": "tenant = :tenant AND category = :category",
"FilterExpression": "status = :status",
"ProjectionExpression": "tenant, id, title",
"ExpressionAttributeValues": {
":tenant": {"S": "tenant-alpha"},
":category": {"S": "returns"},
":status": {"S": "open"}
},
"ScanIndexForward": false,
"Limit": 50,
"ReturnConsumedCapacity": "INDEXES"
}
Supported key-condition shapes:
| Shape | Example |
|---|---|
| Hash-key equality | tenant = :tenant |
| Sort-key equality | tenant = :tenant AND id = :id |
| Sort-key comparison | tenant = :tenant AND created_at >= :start |
| Sort-key between | tenant = :tenant AND created_at BETWEEN :start AND :end |
| Sort-key prefix | tenant = :tenant AND begins_with(id, :prefix) |
Scan is present for compatibility but should not be treated as a safe serving-query substitute. Prefer Query or an MTS access path.
{
"TableName": "Docs",
"FilterExpression": "category = :category",
"ExpressionAttributeValues": {
":category": {"S": "returns"}
},
"Limit": 25
}
{
"RequestItems": {
"Docs": {
"Keys": [
{
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-1"}
}
],
"ProjectionExpression": "tenant, id, title"
}
},
"ReturnConsumedCapacity": "TOTAL"
}
{
"TransactItems": [
{
"Put": {
"TableName": "Docs",
"Item": {
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-2"},
"title": {"S": "Transactional write"}
}
}
},
{
"Update": {
"TableName": "Docs",
"Key": {
"tenant": {"S": "tenant-alpha"},
"id": {"S": "doc-1"}
},
"UpdateExpression": "SET status = :status",
"ExpressionAttributeValues": {
":status": {"S": "review"}
}
}
}
]
}| Operation | Category |
|---|---|
BatchGetItem | Batch |
BatchWriteItem | Batch |
CreateBackup | Backup, import, and export |
CreateGlobalTable | Global tables |
CreateTable | Table administration |
DeleteBackup | Backup, import, and export |
DeleteItem | Items and reads |
DeleteTable | Table administration |
DescribeBackup | Backup, import, and export |
DescribeContinuousBackups | Table administration |
DescribeExport | Backup, import, and export |
DescribeGlobalTable | Global tables |
DescribeImport | Backup, import, and export |
DescribeStream | Streams |
DescribeTable | Table administration |
DescribeTimeToLive | Table administration |
ExportTableToPointInTime | Backup, import, and export |
GetItem | Items and reads |
GetRecords | Streams |
GetShardIterator | Streams |
ImportTable | Backup, import, and export |
ListBackups | Backup, import, and export |
ListGlobalTables | Global tables |
ListImports | Backup, import, and export |
ListStreams | Streams |
ListTables | Table administration |
PutItem | Items and reads |
Query | Items and reads |
RestoreTableToPointInTime | Backup, import, and export |
Scan | Items and reads |
TransactGetItems | Transactions |
TransactWriteItems | Transactions |
UpdateContinuousBackups | Table administration |
UpdateGlobalTable | Global tables |
UpdateItem | Items and reads |
UpdateTable | Table administration |
UpdateTimeToLive | Table administration |
pk = :pkpk = :pk AND sk = :skpk = :pk AND sk < :skpk = :pk AND sk <= :skpk = :pk AND sk > :skpk = :pk AND sk >= :skpk = :pk AND sk BETWEEN :lo AND :hipk = :pk AND begins_with(sk, :prefix)