Skip to content

DynamoDB

Amazon DynamoDB fully managed NoSQL database service with single-digit millisecond performance at any scale.

Configuration

PropertyValue
ProtocolAwsJson1_0
Signing Namedynamodb
Target PrefixDynamoDB_20120810
PersistenceYes

Quick Start

Create a table, put an item, and retrieve it:

bash
# Create table
curl -s http://localhost:4566 \
  -H "Content-Type: application/x-amz-json-1.0" \
  -H "X-Amz-Target: DynamoDB_20120810.CreateTable" \
  -H "Authorization: AWS4-HMAC-SHA256 Credential=test/20260421/us-east-1/dynamodb/aws4_request, SignedHeaders=host, Signature=fake" \
  -d '{"TableName":"users","KeySchema":[{"AttributeName":"pk","KeyType":"HASH"},{"AttributeName":"sk","KeyType":"RANGE"}],"AttributeDefinitions":[{"AttributeName":"pk","AttributeType":"S"},{"AttributeName":"sk","AttributeType":"S"}],"BillingMode":"PAY_PER_REQUEST"}'

# Put item
curl -s http://localhost:4566 \
  -H "Content-Type: application/x-amz-json-1.0" \
  -H "X-Amz-Target: DynamoDB_20120810.PutItem" \
  -H "Authorization: AWS4-HMAC-SHA256 Credential=test/20260421/us-east-1/dynamodb/aws4_request, SignedHeaders=host, Signature=fake" \
  -d '{"TableName":"users","Item":{"pk":{"S":"user#1"},"sk":{"S":"profile"},"name":{"S":"Alice"},"age":{"N":"30"}}}'

# Get item
curl -s http://localhost:4566 \
  -H "Content-Type: application/x-amz-json-1.0" \
  -H "X-Amz-Target: DynamoDB_20120810.GetItem" \
  -H "Authorization: AWS4-HMAC-SHA256 Credential=test/20260421/us-east-1/dynamodb/aws4_request, SignedHeaders=host, Signature=fake" \
  -d '{"TableName":"users","Key":{"pk":{"S":"user#1"},"sk":{"S":"profile"}}}'

Operations

Table Operations

OperationDescription
CreateTableCreate a table with key schema, billing mode, and optional streams. Returns TableDescription with TableStatus: "ACTIVE" immediately
DeleteTableDelete a table and all its data. Returns TableDescription with TableStatus: "DELETING"
DescribeTableGet table metadata: key schema, attribute definitions, item count, table size, stream ARN
ListTablesList all tables; supports ExclusiveStartTableName and Limit for pagination
UpdateTableUpdate billing mode (PAY_PER_REQUEST or PROVISIONED) or stream specification
DescribeEndpointsReturn the regional DynamoDB endpoint. Used by SDK endpoint discovery; returns a single endpoint entry

TTL Operations

OperationDescription
DescribeTimeToLiveGet the TTL configuration for a table. Returns TimeToLiveDescription with TimeToLiveStatus and AttributeName
UpdateTimeToLiveEnable or disable TTL on a table. Input: TableName, TimeToLiveSpecification ({Enabled, AttributeName})

Backup Operations

OperationDescription
DescribeContinuousBackupsGet the point-in-time recovery (PITR) status for a table. Returns ContinuousBackupsDescription
CreateBackupCreate an on-demand backup (stub — returns a backup ARN but does not persist)
DeleteBackupDelete a backup (stub — always succeeds)
DescribeBackupDescribe a backup (stub — always returns not-found)
ListBackupsList on-demand backups (stub — returns empty list)

Global Tables

OperationDescription
DescribeGlobalTableDescribe a global table (stub — returns not-found)
ListGlobalTablesList global tables (stub — returns empty list)

Export / Import

OperationDescription
DescribeExportDescribe an export (stub — returns not-found)
ExportTableToPointInTimeExport to S3 (stub — returns not-supported error)
ListExportsList exports (stub — returns empty list)
DescribeImportDescribe an import (stub — returns not-found)
ImportTableImport from S3 (stub — returns not-supported error)
ListImportsList imports (stub — returns empty list)

Account Limits

OperationDescription
DescribeLimitsReturn default account-level throughput limits (called by Terraform on every plan)

Contributor Insights

OperationDescription
DescribeContributorInsightsDescribe contributor insights for a table (stub — always returns DISABLED)
UpdateContributorInsightsEnable/disable contributor insights (stub — acknowledges the change)
ListContributorInsightsList contributor insights summaries (stub — returns empty list)

Tagging Operations

OperationDescription
TagResourceAdd tags to a table (by ARN). Input: ResourceArn, Tags list
UntagResourceRemove tags from a table. Input: ResourceArn, TagKeys list
ListTagsOfResourceList all tags for a table. Input: ResourceArn. Returns paginated Tags list

Item Operations

OperationDescription
PutItemWrite an item. All attributes use DynamoDB type notation: {"S":"string"}, {"N":"123"}, {"BOOL":true}, {"L":[...]}, {"M":{...}}
GetItemRead an item by primary key. Returns Item or empty if not found. Use ProjectionExpression to return subset of attributes
DeleteItemDelete an item by primary key. Use ReturnValues: "ALL_OLD" to get the deleted item back
UpdateItemUpdate specific attributes using UpdateExpression (e.g., SET #name = :val), ExpressionAttributeNames, ExpressionAttributeValues

Query and Scan

OperationDescription
QueryQuery items using KeyConditionExpression on partition key (and optionally sort key). Supports FilterExpression, ProjectionExpression, Limit, ScanIndexForward (ascending/descending), pagination via ExclusiveStartKey
ScanScan all items with optional FilterExpression. Supports Limit, pagination via ExclusiveStartKey. Use sparingly on large tables

Batch Operations

OperationDescription
BatchGetItemRead up to 100 items from one or more tables in one call. Returns Responses (found items) and UnprocessedKeys (retry these)
BatchWriteItemWrite or delete up to 25 items in one call. Mix of PutRequest and DeleteRequest. Returns UnprocessedItems

Transactions

OperationDescription
TransactGetItemsAtomic multi-table read of up to 25 items; all succeed or all fail
TransactWriteItemsAtomic multi-table write of up to 25 items; mix of Put, Update, Delete, ConditionCheck

PartiQL

OperationDescription
ExecuteStatementExecute a single PartiQL statement. Supports basic SELECT, INSERT INTO ... VALUE {...}, UPDATE ... SET, DELETE FROM with simple WHERE equality conditions
BatchExecuteStatementExecute multiple PartiQL statements; returns per-statement results with partial failures
ExecuteTransactionExecute multiple PartiQL statements as an atomic transaction; any failure aborts all

Streams

OperationDescription
DescribeStreamGet stream metadata including shards. Stream ARN is returned in DescribeTable
GetShardIteratorGet a position marker (TRIM_HORIZON, LATEST, AT_SEQUENCE_NUMBER, AFTER_SEQUENCE_NUMBER)
GetRecordsRead change records from a shard; each record has eventName (INSERT, MODIFY, REMOVE) and dynamodb with old/new images
ListStreamsList streams for a table or account

SDK Example

typescript
import {
  DynamoDBClient,
  CreateTableCommand,
  QueryCommand,
} from '@aws-sdk/client-dynamodb';
import {
  DynamoDBDocumentClient,
  PutCommand,
  GetCommand,
  UpdateCommand,
  DeleteCommand,
} from '@aws-sdk/lib-dynamodb';

const client = new DynamoDBClient({
  region: 'us-east-1',
  endpoint: 'http://localhost:4566',
  credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});

const ddb = DynamoDBDocumentClient.from(client);

// Create table
await client.send(new CreateTableCommand({
  TableName: 'users',
  KeySchema: [
    { AttributeName: 'pk', KeyType: 'HASH' },
    { AttributeName: 'sk', KeyType: 'RANGE' },
  ],
  AttributeDefinitions: [
    { AttributeName: 'pk', AttributeType: 'S' },
    { AttributeName: 'sk', AttributeType: 'S' },
  ],
  BillingMode: 'PAY_PER_REQUEST',
  StreamSpecification: { StreamEnabled: true, StreamViewType: 'NEW_AND_OLD_IMAGES' },
}));

// Put item (Document client handles type marshalling automatically)
await ddb.send(new PutCommand({
  TableName: 'users',
  Item: { pk: 'user#123', sk: 'profile', name: 'Alice', age: 30, tags: ['admin', 'beta'] },
}));

// Get item
const { Item } = await ddb.send(new GetCommand({
  TableName: 'users',
  Key: { pk: 'user#123', sk: 'profile' },
}));
console.log(Item?.name); // Alice

// Update a field
await ddb.send(new UpdateCommand({
  TableName: 'users',
  Key: { pk: 'user#123', sk: 'profile' },
  UpdateExpression: 'SET age = :newAge',
  ExpressionAttributeValues: { ':newAge': 31 },
}));

// Query all items for a user
const { Items } = await client.send(new QueryCommand({
  TableName: 'users',
  KeyConditionExpression: 'pk = :pk',
  ExpressionAttributeValues: { ':pk': { S: 'user#123' } },
}));
console.log('User items:', Items?.length);

CLI Example

bash
# Create table
aws --endpoint-url http://localhost:4566 dynamodb create-table \
  --table-name users \
  --key-schema AttributeName=pk,KeyType=HASH AttributeName=sk,KeyType=RANGE \
  --attribute-definitions AttributeName=pk,AttributeType=S AttributeName=sk,AttributeType=S \
  --billing-mode PAY_PER_REQUEST

# Put item
aws --endpoint-url http://localhost:4566 dynamodb put-item \
  --table-name users \
  --item '{"pk":{"S":"user#1"},"sk":{"S":"profile"},"name":{"S":"Alice"}}'

# Get item
aws --endpoint-url http://localhost:4566 dynamodb get-item \
  --table-name users \
  --key '{"pk":{"S":"user#1"},"sk":{"S":"profile"}}'

# Query
aws --endpoint-url http://localhost:4566 dynamodb query \
  --table-name users \
  --key-condition-expression "pk = :pk" \
  --expression-attribute-values '{":pk":{"S":"user#1"}}'

# Scan with filter
aws --endpoint-url http://localhost:4566 dynamodb scan \
  --table-name users \
  --filter-expression "age > :age" \
  --expression-attribute-values '{":age":{"N":"25"}}'

Behavior Notes

  • DynamoDB is persistent: tables and items survive AWSim restarts.
  • Global Secondary Indexes (GSI) and Local Secondary Indexes (LSI) are accepted in CreateTable but queries with IndexName are not supported — they fall back to a full table scan.
  • Conditional expressions (ConditionExpression on PutItem, UpdateItem, DeleteItem) are stored but not enforced — operations always succeed.
  • TTL (Time to Live) configuration (UpdateTimeToLive) is accepted and stored but items are not automatically expired.
  • DescribeContinuousBackups returns a stub response indicating PITR is disabled — no actual backups are made.
  • DescribeEndpoints returns a single endpoint entry for SDK endpoint discovery compatibility.
  • Table tags (TagResource, UntagResource, ListTagsOfResource) are stored and returned correctly.
  • PartiQL (ExecuteStatement, BatchExecuteStatement, ExecuteTransaction) supports basic SELECT * FROM "Table" WHERE "key" = 'value', INSERT INTO "Table" VALUE {...}, UPDATE "Table" SET attr = val WHERE "key" = 'val', and DELETE FROM "Table" WHERE "key" = 'val'. Full PartiQL expressions, nested paths, and ? parameter binding (with Parameters list) are partially supported.
  • Streams store change records in memory; use GetShardIterator with TRIM_HORIZON to read from the beginning.

Released under MIT / Apache-2.0 License