Dynamodb easy
DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- A Split the PDF into 13 pieces and store them as separate items in a single collection.
- B Store the PDF file in Amazon S3 and save the S3 Object URL ('Pointer') as an attribute in the DynamoDB item.
- C Use the 'SuperSize' attribute type to increase the limit to 10MB.
- D Zip the file into a base64 string to reduce its size below 400KB.
Answer: B. Store the PDF file in Amazon S3 and save the S3 Object URL ('Pointer') as an attribute in the DynamoDB item.
This is the 'Sidecar' or 'Pointer' pattern. DynamoDB is optimized for high-velocity, small-payload lookups. Large blobs are better handled by object storage (S3), which is cheaper for bulk storage and doesn't waste precious RCU/WCU budget.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?
- DynamoDB supports two types of Primary Keys. What is the fundamental difference between a 'Simple' and a 'Composite' primary key?