1 — Can you put photos in DynamoDB?
✅ Technically yes — DynamoDB supports storing binary data using the Binary (B) data type.
But there’s a major limitation:
- Maximum item size in DynamoDB is 400 KB (including keys, attributes, metadata).
Since most photos are well above that size, storing them in DynamoDB is not practical.
It would also be expensive and inefficient because:
- DynamoDB is priced per read/write and storage size.
- Large objects cause higher latency and cost.
- It’s not optimized for large binary data storage.
2 — Large files like JSON or PDF
JSON files:
- If JSON is small (< 400 KB) → yes, you can store it directly in DynamoDB.
- If JSON is large (> 400 KB) → you must store it in S3 and store a reference (S3 URL) in DynamoDB.
PDF files:
- Almost always larger than 400 KB → store in S3, keep metadata and URL in DynamoDB.
Best practice
For anything larger than a few hundred KB (images, videos, PDFs, large JSON files):
- Store the file in Amazon S3 (cheap, scalable, durable).
- Store metadata in DynamoDB, with a reference to the S3 object.
Example schema in DynamoDB:
object_id | filename | s3_url | created_at |
---|---|---|---|
1 | pic.jpg | https://bucket.s3.amazonaws.com/pic.jpg | 2025-10-02 |
Metaphor
Think of DynamoDB like a super-fast notebook for quick lookups — great for small notes (metadata).
Think of S3 like a warehouse — great for storing heavy things like photos, videos, PDFs.
Top comments (0)