samedi 30 mai 2015

Forbidden access to S3 using paperclip and fog

When using fog via paperclip with the following configuration:

config.paperclip_defaults = {
  :storage => :fog,
  :fog_credentials => {
    :provider => 'AWS',
    :aws_access_key_id => ENV['AWS_ACCESS_KEY_ID'],
    :aws_secret_access_key => ENV['AWS_SECRET_ACCESS_KEY'],
    :region => 'eu-central-1'
  },
  :fog_directory => ENV['FOG_DIRECTORY']
}

Access to S3 fails with the following error:

Excon::Errors::Forbidden: Expected(200) <=> Actual(403 Forbidden)
SignatureDoesNotMatch - The request signature we calculated does not match the signature you provided. Check your key and signing method.

Logging directly with the awscli tools using the same credentials and setting the same region works. I double checked the keys. Also, aws s3api get-bucket-location --bucket mybucket returns eu-central-1.




Aucun commentaire:

Enregistrer un commentaire