title: Rails paperclip and amazon S3 'PermanentRedirect'
body: <p>I try to use <strong>paperclip</strong> and Amazon s3. My bucket is in <strong>EU</strong> <strong>(Ireland)</strong> And I got this error :</p>
  
  <pre><code>AWS::S3::Errors::PermanentRedirect in MyControllerController
  
  The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
  </code></pre>
  
  <p>This is very annoying, I tried to fix this but I think I'm gonna die keep trying.</p>
  
  <p>So this is my code :</p>
  
  <pre><code>s3.yml
  
  access_key_id: *****
  secret_access_key: ****
  bucket: mybucketname
  AWS_CALLING_FORMAT: s3-eu-west-1-amazonaws.com #not sure for this one
  </code></pre>
  
  <p>I've put the calling format 10 min ago for a last test, but nothing change</p>
  
  <pre><code> config/initializers/paperclip.rb
  
  
  Paperclip.options[:command_path] = "/usr/local/bin/"
  
  Paperclip::Attachment.default_options[:url] = ':s3_domain_url'
  Paperclip::Attachment.default_options[:path] = '/:class/:attachment/:id_partition/:style/:filename'
  Paperclip::Attachment.default_options[:s3_host_name] = 's3-eu-west-1-amazonaws.com'
  </code></pre>
  
  <p>and so, my model :</p>
  
  <pre><code>has_attached_file :attachment,
    :storage =&gt; :s3,
    :s3_credentials =&gt; "#{Rails.root}/config/s3.yml",
    :path =&gt; "pictures/:id/:style.:extension",
    :bucket =&gt; 'mybucketname'
  </code></pre>
  
  <p>and finally</p>
  
  <pre><code># in config/initializers/something.rb
   Paperclip.interpolates(:s3_eu_url) { |assets, style|
   "#{assets.s3_protocol}://s3-eu-west-1.amazonaws.com/#{assets.recipesappdev}  /#{assets.path(style).gsub(%r{^/}, "")}"
     }
  </code></pre>
  
  <p>So, If I forgot to put a file here, don't hesitate to tell me.
  Anybody has an idea ?</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT :</strong>
  Now I have this error :</p>
  
  <pre><code>getaddrinfo: nodename nor servname provided, or not known
  </code></pre>
  
  <p>... Really no idea</p>