Skip to content

Instantly share code, notes, and snippets.

@stuartlynn
Created August 18, 2014 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartlynn/675cf0dc10e085bff177 to your computer and use it in GitHub Desktop.
Save stuartlynn/675cf0dc10e085bff177 to your computer and use it in GitHub Desktop.
Scribe upload
require 'json'
require 'pry'
require 'aws-sdk'
require 'bson'
AWS.config access_key_id: ENV['S3_ACCESS_ID'], secret_access_key: ENV['S3_SECRET_KEY']
s3 = AWS::S3.new
bucket = s3.buckets['zooniverse-static']
files.each_with_index do |file, index|
puts "done #{index} of #{cal.count}"
id = BSON::ObjectId.new
upload_path = "bucket_name/#{id}.jpg"
options = { file: file, acl: :public_read }
bucket.objects[upload_path].write options
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment