PUT / ObjectName HTTP/1.1
Host: BucketName .s3.amazonaws.com
Date: date
x-amz-meta-Cache-Control : max-age= <value in seconds>
Authorization: signatureValue
Every Metadata setting contains a Key-Value pair. Cache control metadata key is “Cache-Control” and Value is “max-age=<time for which you want your object to be accessed from cache in seconds>”
You can set Cache Control Custom Header for Amazon S3 Objects by sending HTTP PUT Request to Amazon S3 Server with appropriate headers in two ways:
Set Cache Control Metadata using Amazon S3 REST API PUT Object Request - If you are a programmer, you can write your own software program to use Amazon S3 REST or SOAP APIs to set Custom Headers with PUT Object Request. This website only refers to Amazon S3 REST APIs, please refer to AWS documentation website for details on how to use SOAP APIs.
Set Cache Control Metadata using Bucket Explorer User Interface - If you like to set custom HTTP Headers like Cache Control using mouse clicks instead of writing a software program, you can use Bucket Explorer's user interface for that.
With this Custom HTTP Header, you can specify the caching behavior that must be followed with the request/response chain and to prevent caches from interfering with the request or response.
To adjust metadata such as cache-control on an object in S3 without having to re-upload it and without having to use any third party tools, you can do the following with the AWS CLI. It copies the object to itself while overriding the metadata with your chosen settings:
replace <bucket-name> with the name of your bucket
WARNING: this will overwrite all your existing metadata on the files such as acl, just add additional flags to the command to set what you need, e.g., --acl public-read to give full public access. (thanks @jackson)
Another really simple way to do this is to use S3 Browser: http://s3browser.com/ You can simply just shift click or ctrl+a to select all the images you want; then just go to the 'Http Headers' tab and click - 'Add new header' & then 'Apply changes'. It automatically kept all my other permissions and headers.
If you use S3 alot; its a sweet app anyways esp if you have enormous uploads (there's nothing better in the world of ftp, dropbox or otherwise!)