markevans / dragonfly-s3_data_store

S3 data store for the Dragonfly ruby gem
MIT License
62 stars 58 forks source link

S3 store failing when used with IAM #12

Closed volkanunsal closed 9 years ago

volkanunsal commented 9 years ago

I have been trying to configure this gem with IAM profiles. As per instructions in the README, I have set up my dragonfly.rb like so:

datastore :s3,
      use_iam_profile: true,
      bucket_name: ENV['S3_BUCKET']

(Removed the access key and the secret.)

But in the production, I get the following error:

[fog][WARNING] Unable to fetch credentials: Connection refused - connect(2) for 169.254.169.254:80 (Errno::ECONNREFUSED)
  ArgumentError (Missing required arguments: aws_access_key_id, aws_secret_access_key):

Am I doing this right?

benpickles commented 9 years ago

Sorry for the silly question but are you uploading from an EC2 instance?

volkanunsal commented 9 years ago

No, I was testing from my own computer.

volkanunsal commented 9 years ago

The production error was happening on Heroku.

benpickles commented 9 years ago

You would need to own the particular EC2 instance to use IAM in that way (automatic authorisation to other AWS services).

I am using IAM to restrict a Dragonfly-specific AWS user to a specific S3 bucket - :access_key_id and :secret_access_key are still required to authorise the user.

HeathNaylor commented 9 years ago

Then we need to update the README correct? It states this:

:use_iam_profile      # boolean - if true, no need for access_key_id or secret_access_key