Rails and Amazon S3

I will use Amazon S3 for Storing images from my Rails App.

Have any of you made it work? I get access denied when I upload a photo? I don’t know if it’s the politics or Cors.

Hope you will help? Poul Erik Rasmussen

Can you post your configuration (without the actual secrets please). I’ve never had any problems with S3.

Do you use ActiveStorage?

Hi, Yes I use Active_storage.

How does your storage.yml look like?

amazon: service: S3 access_key_id: <%= ENV[‘AWS_ACCESS_KEY_ID’] %> secret_access_key: <%= ENV[‘AWS_SECRET_ACCESS_KEY’] %> region: eu-north-1 bucket: <%= ENV[‘AWS_BUCKET’] %> public: true

I think my problem is Amazon s3.

Can you post the whole error message? How is your S3 bucket configured? Can you screenshot it?

Hi Martin, I getting error in browser - do you need these? Regards, Poul Erik Rasmussen

Here you have the get and post errors. Regards, Poul Erik Rasmussem

If you have the stacktrace for that 500 error that might help. It should be emitted from wherever you are running bin/rails server.

The bucket policy looks like it’s missing a few actions, notably s3:PutObject which is required for uploads.

I also noticed you have s3:deleteobject which should be s3:DeleteObject. AWS bucket policy actions are case-sensitive.

Hopefully that helps.