Reputation: 22674
I'm just getting started with Amazon S3. I'm using s3 to allow my app users to upload images. Every user can upload a certain amount of images and they can manage their images (upload, delete, replace).
I'm not sure which is the best approach with s3. Should I upload all the images into one directory in my bucket and keep records in my database about image uploaders or create a folder for each user in my bucket?
Please share your experience with this service.
Which method works best when storing uploads for each user? Is there a limit on the number of folders that I can use?
Upvotes: 1
Views: 1235
Reputation: 3629
We had the similar decision to be made where users can upload multiple formats of videos and images and we created different folder for each user. It will have few benefits like 1. It is easy to maintain. 2. There will be no name conflicts between two different users uploading files with same name. 3. Also, as mentioned by Brenda, bulk delete will be easy.
I would also recommend you to use s3fs fuse which will mount your s3 bucket as local directory. It will make few of your task very easy.
Upvotes: 1
Reputation: 1139
The answer really depends on the complete requirements.
Analyzing the requirements and the AWS API's to support them might indicate that you need to manage your bucket a certain way.
Upvotes: 1