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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ