CLI for renaming file in S3

1

I've renamed a S3 file with this CLI command:

aws s3 mv s3://bucket/folder/file1 s3://bucket/folder/file2

It took some seconds, so I presume it moved physically the file data. Is there a way to simply rename the file, without moving the data? It will make the command quicker for large files.

1개 답변
1
수락된 답변

That is an interesting questions and I was looking at the possibilities for this. And I believe there is no better or easier way to rename an object other than what you have mentioned. There is no such option available to rename an object in either S3 CLI or s3api CLI. Further, in the AWS doc, it is suggested you have to copy an object in order to rename it.

I was also looking at possible options to somehow change some object metadata. You can see details about object metadata here. However, I don't see any metadata field in system metadata for the object or key name. Furthermore, the document explicitly mentions the following:

After you upload the object, you cannot modify object metadata. The only way to modify object metadata is to make a copy of the object and set the metadata.

So I believe copying the object is going to be your only option.

답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠