Some questions about setting up Amazon S3 with Ruby on Rails

Posted by ben on Stack Overflow See other posts from Stack Overflow or by ben
Published on 2011-01-09T02:48:57Z Indexed on 2011/01/09 2:53 UTC
Read the original article Hit count: 307

I'm trying to setup Amazon S3 hosting with my Ruby on Rails 3 app, which is hosted on Heroku. After reading these instructions in the Heroku docs, I'm trying to use the aws-s3 gem.

The instructions say to put the S3 account details in config/amazon_s3.yml, but the aws-s3 Github page says you create a connection like this:

AWS::S3::Base.establish_connection!(
    :access_key_id     => 'abc', 
    :secret_access_key => '123'
)

Why is the connection created by providing the details if they're already provided in the config file? Is that not the correct way to establish a connection? Do I have to establish a connection for each user everytime an upload is about to occur, or is a connection established for the application as a whole?

Thanks for reading.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about amazon-s3