Skip to content

Instantly share code, notes, and snippets.

@torkale
Created April 15, 2012 07:49
Show Gist options
  • Save torkale/2390771 to your computer and use it in GitHub Desktop.
Save torkale/2390771 to your computer and use it in GitHub Desktop.
download latest backup from S3
require 'rubygems'
require 'fog'
connection = Fog::Storage.new(:provider => 'AWS')
directory = connection.directories.find{|dir| dir.key == ENV['BUCKET_KEY']}
file = directory.files.last
File.open ENV['BACKUP_FILE'], 'w' do |backup|
backup << file.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment