Created
October 7, 2012 06:14
-
-
Save hideack/3847280 to your computer and use it in GitHub Desktop.
AWS::S3 sample
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/s3' | |
include AWS::S3 | |
DEFAULT_HOST.replace "(s3 hostname)" | |
Base.establish_connection!( | |
:access_key_id => '_YOUR_AWS_KEY_', | |
:secret_access_key => '_your_aws_secret_', | |
) | |
S3Object.store( | |
'stbd_logo300-1.png', | |
open('/tmp/stbd_logo300.png'), | |
'testbucket', | |
:content_type => "application/octet-stream" | |
) | |
# List from bucket | |
Bucket.objects("testbucket", :max_keys => 10000).each do | obj | | |
puts obj.key | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment