s3 cp does not copy metadata within s3
My command: aws s3 cp 's3://bucket/a' 's3://bucket/archive/b' --profile myprofile --metadata-directive COPY
I have some metadata on a that's not copied over to b after issuing the above command. Any idea?
To clarify: is some of the metadata being transferred?
Content-Type is there, but none of x-amz-meta-* is transferred.
In that case, is the object large? There is a caveat in the docs:
Note that if the object is copied over in parts, the source object's metadata will not be copied over, no matter the value for --metadata-directive, and instead the desired metadata values must be specified as parameters on the command line.
The object is ~58MB. The copy of metadata worked on the same file with native http PUT request (via x-amz-copy-source header). Why does the s3 command work inconsistently?
At that size, a multipart transfer would occur. Unfortunately, the multipart transfer api does not support copying metadata. If S3 added support then we could then support it. You can request that feature on the service forum.
Hi I'm having the exact same issue, with the exact same command, however my files are not big, in fact, they're empty. They only have metadata, yet it's not being copied.
I'm having the same issue @tiferrei. My files are also empty and can't seem to get the metadata to copy over. Did you ever figure out a workaround?
@2WheelCoder honstely I ended up just using a super simple python script. Left it running for some minutes and it got the job done, but be sure to check your transfer and copy fees.
@JordonPhillips I think this is a serious issue in the S3 API, and I understand that the AWS CLI team believes it's in the S3 team's court to address this. However, what this amounts to is silent loss of data while copying objects, since the metadata just gets dropped on the floor without warning above a certain opaque file size. I think that behavior is a bug and it is very unfortunate that neither team will own it while customers suffer from it. If metadata cannot be copied despite specifying --metadata-directive COPY, then at least the high level command (which aws s3 cp is) should error out.
Do we have any update regarding this? I still see the metadata not moving to the new object at all for small files, by using --metadata-directive COPY