问题
I want to rename a folder in S3 bucket, I understand that rename will run a PUT request which costs 1 cent per 1000 request.
However, the PUT request is defined as a COPY and involves with also a GET
My question is, when we rename a folder in S3 bucket, does it involve copying all sub-folders and files to a new folder with the name I want (which costs more than 1 PUT request), or it just simply 1 PUT request to change the name without touching all the items within the folder.
回答1:
In case you've missed it... there are no folders in S3.
The object /pics/funny/cat.jpg
is not a file called cat.jpg
inside a folder called funny
inside another folder called pics
.
In fact, it is a file with an 18-character name: pics/funny/cat.jpg
. The hierarchy shown in the console is largely for human convenience, and the ability to create new folders in the console is an illusion, also.
So, yes, renaming a "folder" actually means making a new copy of each object in the "folder," with a change to the object names to look like their are in the path.
This can be done with a PUT/COPY
request ($0.005 per 1000 depending on the region) followed by a DELETE
request of the old object (free). There is no corresponding GET
request, because PUT/COPY
is an atomic operation inside S3, so actually downloading and re-uploading the data is avoided.
来源:https://stackoverflow.com/questions/33000329/cost-of-renaming-a-folder-in-aws-s3-bucket