A simple service object to interact with AWS. Currently, it only supports simple operations with S3. However, it can be easily extended to support other AWS services.
-
Add
gem 'aws-sdk'
to your gemfile. -
Set up AWS ENV variables, http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html:
export AWS_ACCESS_KEY_ID='...'
export AWS_SECRET_ACCESS_KEY='...'
export AWS_REGION='us-west-2'
-
Modify the DEFAULT_S3_BUCKET to fit your own needs.
-
Add any new serives in
self.new_session
. Also expire memoized instance variables inself.refresh_session_if_expired
. -
Place this class in app/services, or any directory that's autoloaded in your Rails app.
- Make thread safe.
- Perhaps use a connection pool (which should take care of thread safety).