I have a rails app with Paperclip hosted on Heroku (although I'm only testing locally right now)
I have created a bucket and a user with the AmazonS3FullAccess
policy directly attached.
I have the following in development .rb
config.paperclip_defaults = {
storage: :s3,
s3_credentials: {
bucket: ENV.fetch('S3_BUCKET_NAME'),
access_key_id: ENV.fetch('AWS_ACCESS_KEY_ID'),
secret_access_key: ENV.fetch('AWS_SECRET_ACCESS_KEY'),
s3_region: ENV.fetch('AWS_REGION'),
}
}
However, when I try to attach a profile image to my model, I just get:
Aws::S3::Errors::AccessDenied (Access Denied):
How can I go about debugging this problem? I have deleted and re-created both my IAM user and my bucket, but I cannot figure out where I'm going wrong.
Any insights into how to figure out what I'm missing?
I didn't determine how to debug this issue, however, I did come to a solution.
First of all, I switched to gem 'aws-sdk-s3'
instead of requiring the entire aws-sdk
I realized that I needed to create a policy for my bucket, specifically allowing my user full access. It seems that adding AmazonS3FullAccess to my user was not enough by itself.
I followed this guide step by step and it got me up and running.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With