Skip to content

Instantly share code, notes, and snippets.

@jrsa
Created June 11, 2016 21:50
Show Gist options
  • Save jrsa/f210b528b4ced5174abf28632e10e548 to your computer and use it in GitHub Desktop.
Save jrsa/f210b528b4ced5174abf28632e10e548 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
require 'aws/s3'
include AWS::S3
# set these ENVs for connection
id = ENV['AMAZON_ACCESS_KEY_ID']
key = ENV['AMAZON_SECRET_ACCESS_KEY']
Base.establish_connection!(access_key_id: id, secret_access_key: key)
bucket = Bucket.find(ARGV[1])
results = bucket.objects.select do |ob|
ob.key[ARGV[0]]
end
puts results.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment