Skip to content

DynamoDB

CloudMock emulates Amazon DynamoDB, a fully managed NoSQL key-value and document database, supporting table management, single-item CRUD, queries, scans, and batch operations.

OperationStatusNotes
CreateTableSupportedCreates a table with key schema and billing mode
DeleteTableSupportedDeletes a table and all its items
DescribeTableSupportedReturns table metadata and status
ListTablesSupportedReturns a list of all table names
PutItemSupportedInserts or replaces an item
GetItemSupportedRetrieves a single item by primary key
DeleteItemSupportedRemoves a single item by primary key
UpdateItemSupportedPartial update using UpdateExpression
QuerySupportedQueries items by partition key with optional sort key condition
ScanSupportedScans all items in a table
BatchGetItemSupportedRetrieves up to 100 items across multiple tables
BatchWriteItemSupportedPuts or deletes up to 25 items across multiple tables
Terminal window
# Create a table
curl -X POST http://localhost:4566 \
-H "X-Amz-Target: DynamoDB_20120810.CreateTable" \
-H "Content-Type: application/x-amz-json-1.0" \
-d '{
"TableName": "Users",
"KeySchema": [{"AttributeName": "UserId", "KeyType": "HASH"}],
"AttributeDefinitions": [{"AttributeName": "UserId", "AttributeType": "S"}],
"BillingMode": "PAY_PER_REQUEST"
}'
# Put an item
curl -X POST http://localhost:4566 \
-H "X-Amz-Target: DynamoDB_20120810.PutItem" \
-H "Content-Type: application/x-amz-json-1.0" \
-d '{
"TableName": "Users",
"Item": {"UserId": {"S": "u1"}, "Name": {"S": "Alice"}}
}'
import { DynamoDBClient, CreateTableCommand, PutItemCommand } from '@aws-sdk/client-dynamodb';
const ddb = new DynamoDBClient({
endpoint: 'http://localhost:4566',
region: 'us-east-1',
credentials: { accessKeyId: 'test', secretAccessKey: 'test' },
});
await ddb.send(new CreateTableCommand({
TableName: 'Users',
KeySchema: [{ AttributeName: 'UserId', KeyType: 'HASH' }],
AttributeDefinitions: [{ AttributeName: 'UserId', AttributeType: 'S' }],
BillingMode: 'PAY_PER_REQUEST',
}));
await ddb.send(new PutItemCommand({
TableName: 'Users',
Item: { UserId: { S: 'u1' }, Name: { S: 'Alice' } },
}));
import boto3
dynamodb = boto3.resource('dynamodb', endpoint_url='http://localhost:4566',
aws_access_key_id='test', aws_secret_access_key='test',
region_name='us-east-1')
table = dynamodb.create_table(
TableName='Users',
KeySchema=[{'AttributeName': 'UserId', 'KeyType': 'HASH'}],
AttributeDefinitions=[{'AttributeName': 'UserId', 'AttributeType': 'S'}],
BillingMode='PAY_PER_REQUEST',
)
table.put_item(Item={'UserId': 'u1', 'Name': 'Alice'})
response = table.get_item(Key={'UserId': 'u1'})
print(response['Item'])
cloudmock.yml
services:
dynamodb:
enabled: true

No additional service-specific configuration is required.

  • Secondary indexes (GSI/LSI) are accepted during CreateTable but queries on them fall back to a full scan.
  • UpdateItem supports SET and REMOVE update expressions only. ADD and DELETE are not implemented.
  • BatchWriteItem processes all requests in a single call with no retry/unprocessed-items logic.
  • Streams (DynamoDB Streams) are not implemented.
  • Transactions (TransactWriteItems, TransactGetItems) are not implemented.
  • Time-to-Live (TTL) is not enforced.
CodeHTTP StatusDescription
ResourceNotFoundException400The specified table does not exist
ResourceInUseException400The table already exists
ValidationException400Invalid input (missing required key attributes, etc.)
ConditionalCheckFailedException400A condition expression evaluated to false