Created
May 20, 2014 13:53
-
-
Save shoken0x/e7fc37b2e0fecba48d31 to your computer and use it in GitHub Desktop.
S3の既存データにcache_controlを追加するスクリプト
This file contains 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
require 'aws-sdk' | |
ACCESS_KEY_ID = 'xxxx' | |
SECRET_ACCESS_KEY = 'xxxx' | |
BUKETS = 'xxxx' | |
s3 = AWS::S3.new( | |
access_key_id: ACCESS_KEY_ID, | |
secret_access_key: SECRET_ACCESS_KEY) | |
bucket = s3.buckets[BUKETS] | |
one_year_in_seconds = 365 * 24 * 60 * 60 | |
o = bucket.objects[ARGV[0]] | |
o.copy_to o.key, cache_control: "public, max-age=#{one_year_in_seconds}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment