tags:

views:

755

answers:

4

I've uploaded a bunch of images to Amazon S3, and now want to add a Cache-Control header to them.

Can the header be updated without downloading the entire image? If so, how?

A: 

I'm afraid that this is not possible with the current API. S3 does not allow changing headers on existing files. So, you will have to upload the entire file again.

splattne
+9  A: 

It's beta functionality, but you can specify new meta data when you copy an object. Specify the same source and destination for the copy, and this has the effect of just updating the meta data on your object.

PUT /myObject HTTP/1.1
Host: mybucket.s3.amazonaws.com  
x-amz-copy-source: /mybucket/myObject  
x-amz-metadata-directive: REPLACE  
x-amz-meta-myKey: newValue
stevemegson
A: 

Actually you can copy a file within S3 storage to the same location and replace http headers. This way you don't have to re-upload the file from local computer to S3. This is how we do it in CloudBerry Explorer

cloudberryman
Does it do the copy in-place, or do you need to pull it to your machine and push it back to S3?
Scott
It will do a copy in-place. It will not pull it to your local machine
cloudberryman
A: 

the x-amz-metadata-directive header doesn't work. It results in a signature mismatch every time. All other x-amz headers work fine.

Charles