title: PermanentRedirect Exception: aws-sdk s3 Rails 5
body: <p>I'm trying to list or retrieve objects from an amazon bucket and I keep getting this error message:</p>
  
  <pre><code>(byebug) resp = s3.list_objects(bucket:'mp3list')
  *** Aws::S3::Errors::PermanentRedirect Exception: 
  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>I can upload and delete files from the same bucket with no problem.</p>
  
  <p>Does someone know how to specify that endpoint? and where?</p>
  
  <p>My configuration of the s3 bucket:</p>
  
  <pre><code>Bucket: mp3play
  Region: Frankfurt
  Creation Date:  Fri Dec 09 17:44:39 GMT+100 2016
  Owner: aaa
  
  Can list, upload, delete.
  </code></pre>
  
  <p>aws.rb ></p>
  
  <pre><code>Aws.config.update({
    credentials: Aws::Credentials.new(ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY']),
    region: 'eu-central-1'
  })
  
  # list buckets in Amazon S3
  s3 = Aws::S3::Client.new
  resp = s3.list_buckets
  S3_BUCKET = resp.buckets[0]
  resp.buckets.map(&amp;:name)
  
  S3 = Aws::S3::Resource.new(region: 'eu-central-1')
  </code></pre>