Skip to content

Maximum Item Size in DynamoDB for Storing Base64 Images

0

I'm using Amazon DynamoDB and trying to store images encoded in Base64 format in a string attribute. I ran into a limitation where I can’t tell exactly when the size is exceeded.

What is the maximum size allowed for a single item in DynamoDB? Is there a way to increase this limit, or a recommended approach for storing larger Base64-encoded files (e.g., images)?

What I tried: Saving the Base64 string directly into a string attribute. No error until the item became too large, but I couldn’t find the exact threshold.

Goal: Understand the item size limit and best practices for storing large binary content in DynamoDB (if feasible), or suggested alternatives.

asked 9 months ago357 views
1 Answer
2

Hello.

The maximum size of an item that can be stored in a table is 400KB.
https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-use-s3-too.html

Amazon DynamoDB limits the size of each item that you store in a table to 400 KB (see Quotas in Amazon DynamoDB). If your application needs to store more data in an item than the DynamoDB size limit permits, you can try compressing one or more large attributes or breaking the item into multiple items (efficiently indexed by sort keys).

As stated in the following document, DynamoDB is not suitable for storing images, so it is better to store them in S3 or another storage medium.
https://aws.amazon.com/dynamodb/faqs/?nc1=h_ls#topic-1

While it's technically possible to store images in DynamoDB as binary data (base64-encoded), there are some limitations and drawbacks due to the 400KB item limit size. Instead of storing images directly in DynamoDB, a better practice is to store the images in Amazon S3 (Simple Storage Service) and then store the S3 object URL or key in DynamoDB.

EXPERT
answered 9 months ago
EXPERT
reviewed 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.