Reputation: 2613
I'm new to Amazon S3 and I want to write a little "dropbox" application with php. Therefore I want to limit the amout of data a user could upload to a specific limit, let's say 1GB. I want to create a folder for each user (does S3 support folders or only filenames like /dir/filename.extension?). Is it possible to get the size of the folder of a user and display e.g. a progress bar with the space curently used? Do I have to perform a check whether the space is completely used each time a user wants to upload a file or is there a solution to set the limit for directories directly in S3?
Thanks for your help!
Upvotes: 0
Views: 1126
Reputation: 42627
S3 only has the concept of buckets, and buckets cannot be nested. Furthermore, bucket names must be unique across all of S3 -- all users' buckets.
The default account limit is about 90 buckets for a single AWS account, so factor that into your design.
You can get sizes of buckets and individual files in a bucket from the SDK, though it will be a lot cheaper if you have any way of keeping that information locally and not having to round-trip to AWS to get it.
There is no built-in quota support that I know of, so you will have to track this yourself. Plus, with a 90 bucket limit, you might need to implement some kind of virtualized directory scheme inside of an S3 bucket to allow multiple users' data in the same bucket.
Upvotes: 2