how to add cache control in AWS S3?

Rajaraman picture Rajaraman · Mar 19, 2014 · Viewed 76.2k times · Source

I have moved 20000 files to AWS S3 by s3cmd command. Now i want to add cache-control for all images (.jpg)

These files are located in ( s3://bucket-name/images/ ). How can i add cache-control for all images by s3cmd or is there any other way to add header ?

Thanks

Answer

user3440362 picture user3440362 · Mar 20, 2014

Please try the current upstream master branch (https://github.com/s3tools/s3cmd), as it now has a modify command, used as follows:

./s3cmd --recursive modify --add-header="Cache-Control:max-age=86400" s3://yourbucket/