title: Rails4.1: AWS errors missing region
body: <p>I'm trying to create an image uploader using paperclip, the aws-sdk gem and Amazon S3.
  I get this error:</p>
  <pre><code>Aws::Errors::MissingRegionError in ProjectsController#create. 
  Missing region; use :region option or export region name to ENV['AWS_REGION']. using Oregon region. 
  </code></pre>
  <p><strong>projects_controller.rb</strong></p>
  <pre><code>def create
      @project = current_user.projects.new(project_params)
      @project.save
      respond_with(@project)
  end
  </code></pre>
  <p><strong>application.rb file</strong></p>
  <pre><code>config.paperclip_defaults = {
          storage: :s3,
          s3_host_name: &quot;s3-us-west-2.amazonaws.com&quot;,
          s3_credentials: {
              bucket: ENV['AWS_BUCKET'],
              access_key_id: ENV['AWS_ACCESS_KEY_ID'],
              secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
          }
      }
  </code></pre>
  <p>According to the S3 documentation I understand I need to change to ENV['AWS_REGION']</p>
  <pre><code>config.paperclip_defaults = {
          storage: :s3,
              region: &quot;ENV['AWS_REGION&quot;],
          s3_credentials: {
              bucket: ENV['AWS_BUCKET'],
              access_key_id: ENV['AWS_ACCESS_KEY_ID'],
              secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
          }
      }
  </code></pre>
  <p>and add region to my .env file</p>
  <pre><code>export AWS_BUCKET=realv1
  export AWS_ACCESS_KEY_ID=&lt;MY_ACCESS_KEY_ID_HERE&gt;
  export AWS_SECRET_ACCESS_KEY=&lt;MY_ACCESS_KEY_HERE&gt;
  export AWS_REGION=&quot;'us-west-2'
  </code></pre>
  <p>I rebooted the server and retested but still get the same errors.</p>
  <p>update</p>
  <p>update:</p>
  <p>in rails console</p>
  <p>2.0.0p247 :001 &gt; ENV[&quot;AWS_REGION&quot;]</p>
  <p>=&gt; &quot;us-west-2&quot;
  2.0.0p247 :002 &gt;</p>