Created
March 20, 2013 18:36
-
-
Save mikedemers/5207257 to your computer and use it in GitHub Desktop.
Ruby script that sends a file to an S3 bucket
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'aws/s3' | |
bucket = ARGV[0].to_s.strip | |
filepath = ARGV[1].to_s.strip | |
filename = ARGV[2] ? ARGV[2].to_s.strip : File.basename(filepath) | |
AWS::S3::Base.establish_connection!( | |
:access_key_id => 'xxxxxxx', | |
:secret_access_key => 'xxxxxxx' | |
) | |
AWS::S3::S3Object.store(filename, open(filepath), bucket) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment