Can DynamoDB store images?

Yes, but only small ones. DynamoDB can store images as base64-encoded Binary (B) attributes, provided the whole item stays under the 400 KB limit. AWS recommends storing larger images in Amazon S3 and keeping just the object metadata and an S3 reference in DynamoDB, since 400 KB is too small for most media files.

How small-image storage works

Encode the image as base64 and store it in a Binary attribute. DynamoDB measures the raw byte length toward the 400 KB item cap, so a thumbnail or icon fits; a full photo usually does not.

For anything larger than 400 KB:

  1. Upload the image to Amazon S3.
  2. Store its S3 key, size, content type, and other metadata in DynamoDB.
  3. Read the metadata from DynamoDB, then fetch the object from S3.

Note that DynamoDB and S3 do not share transactions, so your app must clean up orphaned objects on failure.

Go deeper

See max item size and measure items with the item size calculator. Download DynoTable to inspect binary attributes.

Trabalhe com o DynamoDB sem o Console

O DynoTable é um cliente desktop rápido para o DynamoDB — navegue pelas tabelas, execute consultas no estilo SQL e edite itens localmente.