Leon
Leon

Reputation: 6554

Amazon S3 Cache-Control for all bucket

I use Amazon S3 and CloudFront. I have static images and users downloaded images(every hour + 100 images).

I need to set Cache-Control http header for all bucket.

I search in google, but I cant find any instruction, how to do this.

Yes, I know about MetaData in file Properties, but I need MetaData for all bucket (+ new files in future).

If it is not possible to do in Amazon console, is there any open source solutions?

Thanks!

Upvotes: 4

Views: 1669

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179404

S3 does not have a mechanism for setting global bucket metadata on existing or future objects. Your code needs to set this when the objects are created.

You can add it to existing objects using the "put/copy" operation of the API, which allows you to copy an object onto itself, with modified metadata, without actually downloading and re-uploading the object.

http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectCOPY.html

Regarding open-source solutions, there might be, but the only possible mechanism they could use would be to perform the same actions -- iterating through the bucket and updating each object's metadata via the API. In any event, though:

Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam.

https://stackoverflow.com/help/on-topic

Upvotes: 4

Related Questions