Securely sync (upload and download) files with Amazon Simple Storage Service (s3).
Specify credentials, file names, and other options during configuration.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install s3_sync
Create an AWS Identity and Access Management (IAM) user.
Note: the s3 user's Access Key Id and Secret Access Key
Create an AWS IAM policy with the permissions:
Create an AWS IAM group, add the user to the group, and attach the policy to the group.
Use the same options when uploading and downloading.
S3Sync.configure do |config| config.key_id = "mykey123" config.key_secret = "mysecret456" config.region = "us-east-1" config.bucket = "s3-uploads" config.secret_phrase = "supersecret" config.files = [ File.join(Dir.home,".gitconfig"), File.join(Dir.home,".ssh","config") ] config.downloads_dir = File.join(Dir.home,"Desktop","s3-downloads") end
||The s3 user's Access Key Id.|
||The s3 user's Access Key Secret.|
||The s3 region.|
||The s3 bucket (top-level directory) name.|
||The phrase to use when encrypting and decrypting files.|
||A list of local file paths to be synced.|
||A staging directory to house downloaded files. Defaults to ~Desktop/s3-downloads.|
Upload files from your computer to s3.
The uploads bucket gets created automatically, and can be configured with
Download files from s3 to your computer.
Files are downloaded to a staging directory, which can be configured with
config.downloads_dir. The staging directory helps mitigate the risk of accidentally over-writing local files.
After forking the repo and pushing your changes, create a pull request referencing the applicable issue(s).
Check out the repo with
git clone firstname.lastname@example.org:s2t2/s3-sync-ruby.git, and
After checking out the repo, run
bin/setup to install dependencies.
bundle exec rake or
bundle exec rspec spec/ to run the tests.
You can also run
bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run
bundle exec rake install.
Update the version number in
version.rb, then run
bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the
.gem file to rubygems.org.