Matt
Matt

Reputation: 4570

AWS S3 copy/paste does not copy metadata

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.

Upvotes: 4

Views: 3260

Answers (1)

Matt
Matt

Reputation: 4570

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.

Upvotes: 3

Related Questions