Created
October 11, 2012 10:19
-
-
Save seratch/3871455 to your computer and use it in GitHub Desktop.
CDPStudyGroup S3 example
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
| access_key_id: xxx | |
| secret_access_key: yyy |
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
| #!/usr/bin/env ruby | |
| require 'yaml' | |
| require 'aws-sdk' | |
| config_file = File.join(File.dirname(__FILE__),"config.yml") | |
| config = YAML.load(File.read(config_file)) | |
| AWS.config(config) | |
| s3 = AWS::S3.new | |
| bucket = s3.buckets[:seratchtokyoexample] | |
| foo = bucket.objects["foo"] | |
| # upload content | |
| foo.write(Time.now.to_s) | |
| # make public | |
| foo.acl.change do |acl| | |
| acl.grant(:read).to(:group_uri => 'http://acs.amazonaws.com/groups/global/AllUsers') | |
| end | |
| # https://s3-ap-northeast-1.amazonaws.com/seratchtokyoexample/foo |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://docs.amazonwebservices.com/AWSRubySDK/latest/frames.html