Skip to content

Instantly share code, notes, and snippets.

@jeremywrowe
Created January 9, 2011 16:00
Show Gist options
  • Save jeremywrowe/771776 to your computer and use it in GitHub Desktop.
Save jeremywrowe/771776 to your computer and use it in GitHub Desktop.
grabbing object info from a bucket s3
require "aws/s3"
AWS::S3::Base.establish_connection!(
:access_key_id => 'KEY_GOES_HERE',
:secret_access_key => 'KEY_SECRET_GOES_HERE'
)
object = AWS::S3::S3Object.find 'OBJECT_NAME_GOES_HERE','BUCKET_NAME_GOES_HERE'
puts object.etag # MD5 SUM
object_in_megabytes = (object.size / 1024.0) / 1024.0
puts "%.3fMb" % object_in_megabytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment