Last active
June 14, 2016 13:33
-
-
Save bruchu/8230184 to your computer and use it in GitHub Desktop.
change s3 content-type using aws ruby sdk
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
bash: | |
export AWS_ACCESS_KEY_ID='...' | |
export AWS_SECRET_ACCESS_KEY='...' | |
export AWS_REGION='us-east-1' | |
irb or ruby script: | |
require 'aws-sdk' | |
s3 = AWS::S3.new | |
bucket_name = 'bucket-name' | |
# a copy needs to be done to change the content-type | |
s3.buckets[bucket_name].objects.each do |object| | |
k = object.key | |
s3.buckets[bucket_name].objects[k].copy_from(k, :content_type => 'text/html') | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment