mardi 1 septembre 2015

Images not saved with Paperclip on Elastic Beanstalk using S3

I just want to save images in production mode(elastic beanstalk), it was working fine in development mode but to make it work in production mode i tried using S3 but now I get the following error:

Error: The AWS Access Key Id you provided does not exist in our records.

What I did:
Production.rb

    config.paperclip_defaults = {
  :storage => :s3,
  :s3_credentials => {
  :bucket => 'mybucket', 
  :access_key_id => ENV['AWS_ACCESS_KEY'],
  :secret_access_key => ENV['AWS_SECRET_ACCESS_KEY']
 }
}

Development.rb

  config.paperclip_defaults = {
  :storage => :s3,
  :s3_credentials => {
  :bucket => 'mybucket',
  :s3_credentials => "#{Rails.root}/config/s3.yml",
 }
}

config/s3.yml

bucket: "mybucket"
access_key_id: "<Added my access id here>"
secret_access_key: "<Added my secret key here>"

User.rb

has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :default_url => lambda { |avatar| avatar.instance.set_default_url}

I did not specifically "create" a bucket named mybucket using aws and i am not sure if i have to or how to.
Please let me know if i can provide any other details.




Aucun commentaire:

Enregistrer un commentaire