Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to store Image profile(jpg file) and PDF documents in AWS DynamoDB?

I am migrating my Spring MVC services to the AWS API Gateway using Python Lambda with Dynamo Db , I have endpoint where i can store or retrieve the people image and also the reports which is PDF file , can you please suggest me which is the best practice to store the images and pdf files in AWS .

Your help is really appreciated!!

like image 655
Pandit Biradar Avatar asked Mar 07 '23 07:03

Pandit Biradar


2 Answers

Keep in mind, DynamoDB has a 400KB limit on each item.

I would recommend using S3 for images and PDF documents. It also allows you to set up a CDN much more easily, rather than using something like DynamoDB.

You can always link your S3 link to an item in DynamoDB if you need to store data related to the file.

like image 102
Abhaya Chauhan Avatar answered Apr 07 '23 14:04

Abhaya Chauhan


AWS DynamoDB has a limit on the row size to be max of 400KB. So, it is not advisable to store the binary content of image/PDF document in a column directly. Instead, you should store the image/PDF in S3 and have the link stored in a column in DynamoDB.

If you were using Java, you could have leveraged the S3Link abstraction that takes care of storing the content in S3 and maintaining the link in DynamoDB column.

like image 45
Vikdor Avatar answered Apr 07 '23 14:04

Vikdor