AWS S3 copy/paste does not copy metadata

2019-03-01 06:49发布

Using the Amazon web interface, it is possible to copy an S3 object from one bucket to another.

enter image description here

However, the pasted object does not have the metadata of the original. How can the metadata be pasted at the same time?

I'm guessing that the CLI can do it, but I can't figure out how.

Note, the metadata must be created with the object so it is available in the lambda function triggered on the S3 PUT.

1条回答
够拽才男人
2楼-- · 2019-03-01 07:47

So I have figured out how to do it via the CLI.

aws s3 cp s3://<source bucket>/<filename> s3://<destination bucket>

The documentation states

--metadata-directive (string) Specifies whether the metadata is copied from the source object or replaced with metadata provided when copying S3 objects. ... Valid values are COPY and REPLACE. If this parameter is not specified, COPY will be used by default.

(My emphasis.)

All quite easy really. Very strange that the web interface does not do the same.

查看更多
登录 后发表回答