我有几个对象存储在 Amazon S3 中,我需要将其内容类型从更改text/html
为application/rss+xml
. 我认为应该可以使用复制命令来执行此操作,为源和目标指定相同的路径。我正在尝试使用 AWS cli 工具执行此操作,但出现此错误:
$ aws s3 cp s3://mybucket/feed/ogg/index.html \
s3://mybucket/feed/ogg/index.html \
--content-type 'application/rss+xml'
copy failed: s3://mybucket/feed/ogg/index.html
to s3://mybucket/feed/ogg/index.html
A client error (InvalidRequest) occurred when calling the
CopyObject operation: This copy request is illegal because it is
trying to copy an object to itself without changing the object's
metadata, storage class, website redirect location or encryption
attributes.
如果我为源和目标指定不同的路径,我不会收到错误消息:
$ aws s3 cp s3://mybucket/feed/ogg/index.html \
s3://mybucket/feed/ogg/index2.html \
--content-type 'application/rss+xml'
copy: s3://mybucket/feed/ogg/index.html
to s3://mybucket/feed/ogg/index2.html
即使命令成功完成,index2.html
对象也是使用text/html
内容类型创建的,而不是application/rss+xml
我指定的类型。
如何修改此命令行以使其正常工作?