Uploading files with similar filename in Amazon S3
Basically, how does Amazon S3 handle files which already have the same filename inside a specified bucket? Assuming I can only upload to one particular bucket, will S3 change the filename or something?
Thanks!
No, if the name is the same, you will just overwrite the file. That is why it is best to prefix the files so that they have unique names/ paths
Most uploads to S3 use 'filenames' which are what Amazon S3 calls keys that look like paths to 'normal people' EG: Documents/important/project1/somefile.txt
If you pass the same key to upload a file, it is replaced, unless versioning is on.
S3 supports versioning. This means that when you upload to the same key twice, two versions of the file are stored. Note that if you upload the exact same file twice, you get to pay for two identical copies of the same file on S3. So you need to be careful uploading the same file to S3 many times in a row with versioning on.
To use versioning, you need to turn it on for your S3 bucket.
Also, for small files, the actual cost of a PUT statement needs to be taken into account: it not only costs $0.15 /GB + small overhead per file, but it also costs $1.00 to upload 100,000 files to S3.