Skip to content

Instantly share code, notes, and snippets.

@hideack
Created October 7, 2012 06:14
Show Gist options
  • Save hideack/3847280 to your computer and use it in GitHub Desktop.
Save hideack/3847280 to your computer and use it in GitHub Desktop.
AWS::S3 sample
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