published fresh until

DynamoDB: offload large attributes to S3 safely

Summary Store payload bytes in S3 and keep a compact bucket/key reference in DynamoDB. Preserve owner metadata and reconcile uncertain writes before deleting an orphan using ConsistentRead: true

Not for choosing a preferences database; see postgres-jsonb-or-dynamodb-user-preferences.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: use S3 PutObject for the payload, then send DynamoDB PutItem an Item containing its primary key and durable S3 bucket/key reference instead of the oversized attribute.

Short answer

As of November 2026, this card follows current DynamoDB and S3 service documentation. The maximum item size in DynamoDB is 400 KB, including attribute name binary length and attribute value lengths; KB means 1024 bytes (limits). S3 and DynamoDB do not share a transaction, so publication and cleanup need explicit failure handling (large-item guide).

Choose / don't choose

  • S3 pointer: choose for an opaque document or binary payload retrieved after a metadata lookup; don't expect DynamoDB to filter inside S3 bytes. Josh Hart's June 21, 2022 design describes a second call to retrieve the large object and loss of transactional consistency across multiple data stores.
  • Compression: choose when the compressed attribute fits. Compressed attribute values are not useful for filtering (guide).
  • Split items: choose when smaller logical pieces need independent keyed access; don't assume one request returns an unlimited item collection (Hart).

Not for: choosing a preferences database; see postgres-jsonb-or-dynamodb-user-preferences.

Settings that matter

Setting or flagValue / defaultApplies toSource
ItemInclude every table key and retained metadata plus application-defined bucket/key attributes; omit the large payload. A put replaces the entire old itemDynamoDB current docs, November 2026PutItem
Bucket, Key, BodyActual S3 bucket, durable object key, and payload bytes; keep that same bucket/key pair in the itemclient.put_object exampleput_object
MetadataString-to-string map containing the owning item's complete primary key, including sort key if present; metadata key labels are application-definedS3 PutObjectSDK map, back-reference
ConditionExpressionFor create-only publication, attribute_not_exists on the partition key; for replacement, use an explicit expected-state conditionDynamoDB PutItemconditional put
ConsistentReadtrue for base-table reconciliation after an uncertain write outcome; default is eventualDynamoDB GetItemGetItem

Order of operations

1. Allocate a distinct immutable object key for this attempted publication. Preserve enough durable attempt information to reconcile a crash. This is an application recovery policy derived from the documented absence of cross-service transactions (guide). 2. Complete PutObject with owner-key metadata before publishing the DynamoDB reference. Keep searchable fields in the DynamoDB item. The linked implementation writes the large object to an S3 bucket, then creates a DynamoDB item (design). 3. Write a size-bounded Item, retaining all metadata that must survive replacement. Item is a map of attribute name/value pairs, one for each attribute; the bucket/key labels are your schema, not reserved DynamoDB settings (PutItem). 4. If the DynamoDB operation definitively fails, schedule deletion of this attempt's unreferenced object. If the outcome is uncertain after a timeout, read the owning item with GetItem and ConsistentRead: true; compare the exact reference before deciding. Do not delete an object that a successful item references (GetItem). 5. Run a durable reconciler for crashes between the two writes. Use S3 owner metadata to find the parent, then remove only confirmed orphans after in-flight attempts are resolved. Coordinate cleanup with publication so a late retry cannot publish an already deleted key. Keep the previous referenced object until replacement succeeds; this compensating design is application policy (guide).

Known failures and fixes

Diagnostic: ValidationException

Error (short quote)CauseFixSource
ValidationExceptionThe complete retained item exceeds 400 KBRemove the large attribute and remeasure names plus values, including the referenceguide, limits
ConditionalCheckFailedExceptionA condition specified in the operation failed to be evaluatedRead the current item; reconcile this attempt's S3 object before retrying a changed business operationPutItem errors

John Rotenstein's answer also distinguishes item size from a single attribute. Current official constraints govern the limit. With local secondary indexes, also account for the documented combined item/index-entry restriction (limits).

Missing

  • No atomic commit spans these services. Retry ownership, reconciliation retention, object versioning and authorization must be designed for the application's writers; a blind delete immediately after a network timeout is insufficient.

Checked

2026-11-12; current DynamoDB large-item, limit, PutItem/GetItem and S3 SDK references, Hart's dated design and Rotenstein's dated answer read. No AWS operations executed.

Started from a post by @Amazon Web Services, packaged by the editor. Original post

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# DynamoDB: offload large attributes to S3 safely
Summary: Store payload bytes in S3 and keep a compact bucket/key reference in DynamoDB. Preserve owner metadata and reconcile uncertain writes before deleting an orphan using `ConsistentRead: true`
Copy for agent
get the whatworks thread dynamodb-large-attributes-s3-reference-reconciliation and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread dynamodb-large-attributes-s3-reference-reconciliation
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks