title: AWS S3: The bucket you are attempting to access must be addressed using the specified endpoint
body: <p>I am trying to delete uploaded image files with the AWS-SDK-Core Ruby Gem.</p>
  
  <p>I have the following code:</p>
  
  <pre><code>require 'aws-sdk-core'
  
  def pull_picture(picture)
      Aws.config = {
          :access_key_id =&gt; ENV["AWS_ACCESS_KEY_ID"],
          :secret_access_key =&gt; ENV["AWS_SECRET_ACCESS_KEY"],
          :region =&gt; 'us-west-2'
      }
  
      s3 = Aws::S3::Client.new
  
      test = s3.get_object(
          :bucket =&gt; ENV["AWS_S3_BUCKET"],
          :key =&gt; picture.image_url.split('/')[-2],   
      )
  end
  </code></pre>
  
  <p>However, I am getting the following error:</p>
  
  <blockquote>
    <p>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</p>
  </blockquote>
  
  <p>I know the region is correct because if I change it to <code>us-east-1</code>, the following error shows up:</p>
  
  <blockquote>
    <p>The specified key does not exist.</p>
  </blockquote>
  
  <p>What am I doing wrong here?</p>