Reputation: 41
I can set 'Cache-Control'(meta data) of a particular file and a particular bucket in amazon S3.
But I want that Cache-Control
to be set for every file in a particular folder(not the entire bucket, but only folder).
Also when I upload a new file in that particular folder, Cache-Control
header gets automatically set for the new file.
I have followed this and S3 Documentation.
Is there any way by which this can be achieved?
Upvotes: 3
Views: 6135
Reputation: 562
@FreeFly
It seems like with the new updates to the S3 console UI, there is now an option to add metadata on a directory, and doing so will recursively apply metadata to each object within that directory.
Go to
object
(can be a directory)Upvotes: 1
Reputation: 1150
Based on another question's answer here I found that with this tool we can run a recursive for all files in a particular folder, but this won't be applied for the new files.
steps:
git clone https://github.com/s3tools/s3cmd
Run s3cmd --configure
(You will be asked for the two keys - copy and paste them from your confirmation email or from your Amazon account page. Be careful when copying them! They are case sensitive and must be entered accurately or you'll keep getting errors about invalid signatures or similar. Remember to add s3:ListAllMyBuckets permissions to the keys or you will get an AccessDenied error while testing access.)
./s3cmd --recursive modify --add-header="Cache-Control:public ,max-age= 31536000" s3://your_bucket_name/
Upvotes: 3