Created
April 1, 2015 19:37
-
-
Save amui/bf083bcb79e33519a8a7 to your computer and use it in GitHub Desktop.
Set cache-control max-age for objects in S3 bucket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boto.s3.connection import S3Connection | |
# make sure api creds set, KEY/SECRET are just placeholders | |
connection = S3Connection(KEY, SECRET) | |
bucket = connection.get_bucket("just.a.test.bucket.really") | |
keys = bucket.get_all_keys() | |
for key in keys: | |
key.set_metadata('Cache-Control','max-age=43200') | |
key.copy( | |
key.bucket.name, | |
key.name, | |
key.metadata, | |
preserve_acl=True | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment