Sunday 12 June 2016

Set max-age of all S3 Objects

Set max-age on all S3 objects 

If you want to speed up the content being served from S3 (or via Cloudfront) than you should set max-age on the objects. You can manually update the Cache-Control header on the AWS web-ui but if there are lots of objects to be updated than you can use S3CMD to do the same.

First get the S3CMD tool installed and configured by following this post. Than just run the following command to add the Cache-Control header.


s3cmd --recursive modify --add-header="Cache-Control:public ,max-age=31536000" s3://your_bucket_name/

Change the your_bucket_name to the actual bucket name. Also change the max-age value as per your need 31536000 for one year and 86400 for one day (Keep it as per your requirement).

0 comments:

Post a Comment

 

Copyright @ 2013 Appychip.

Designed by Appychip & YouTube Channel