AWS :: Errors :: MissingCredentialsBłęd przy użyciu paperclip i aws-s3 w szynach 3.1
Próbuję przesłać obraz w aws.
class Asset < ActiveRecord::Base
belongs_to :post
attr_accessible :image
has_attached_file :image, :styles => { :medium => "640x480>",
:thumb => "100x100#"},
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/s3.yml",
:path => ":attachment/:id/:style.:extension",
:bucket => 'yourbucket'
end
s3.yml
development:
access_key_id: xxxxxxxx
secret_code: xxxxx
Dostaję wiadomość
AWS::Errors::MissingCredentialsError in PostsController#create
Missing Credentials.
Unable to find AWS credentials. You can configure your AWS credentials
a few different ways:
* Call AWS.config with :access_key_id and :secret_access_key
* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV
* On EC2 you can run instances with an IAM instance profile and credentials
will be auto loaded from the instance metadata service on those
instances.
* Call AWS.config with :credential_provider. A credential provider should
either include AWS::Core::CredentialProviders::Provider or respond to
the same public methods.
= Ruby on Rails
W aplikacji Ruby on Rails możesz również określić swoje poświadczenia w następujący sposób:
Za pomocą skryptu inicjującego konfigurację przy użyciu dowolnej z wyżej wymienionych metod (np. RAILS_ROOT / config / initializers / aws-sdk.rb).
Poprzez plik konfiguracyjny yaml znajdujący się w RAILS_ROOT / config / aws.yml. Ten plik powinien być sformatowany jak domyślny plik RAILS_ROOT / config / database.yml.
Wierzę, że robię ostatni krok.
Gemfile
gem 'rails', '3.1.3'
gem 'mysql'
gem 'koala'
gem 'paperclip'
gem 'aws-s3'
gem 'aws-sdk'