title: How to grant permissions to AWS user for Hartl's rails tutorial
body: <p>I don't know how (or where also) to grant read and write permission to the user from AWS so users can post pictures on sample_app in production enviroment. This is final task in 11th chapter, it isn't covered by tutorial and I can't find solution anywhere.</p>
  
  <p>This is <code>carrier_wave.rb</code> file:</p>
  
  <pre><code>if Rails.env.production?
    CarrierWave.configure do |config|
      config.fog_credentials = {
        # Configuration for Amazon S3
        :provider              =&gt; 'AWS',
        :aws_access_key_id     =&gt; ENV['lalala'],
        :aws_secret_access_key =&gt; ENV['oloalle']
      }
      config.fog_directory     =  ENV['name of bucket']
    end
  end
  </code></pre>
  
  <p>This is procedure from tutorial:
  1) create AWS IAM User and record access and secret key - done</p>
  
  <p>2) create S3 bucket - done</p>
  
  <p>3) <strong>grant read and write permission to the user created in the previous step</strong> - how???</p>
  
  <p>4) I then run this three commands: </p>
  
  <pre><code>$ heroku config:set S3_ACCESS_KEY=lalala
  $ heroku config:set S3_SECRET_KEY=oloalle
  $ heroku config:set S3_BUCKET=name of bucket
  </code></pre>
  
  <p>5) push to git and heroku - done</p>
  
  <p>6) <code>heroku pg:reset DATABASE</code> - done</p>
  
  <p>7)<code>heroku run rake db:migrate</code> and here I get this message:</p>
  
  <pre><code>Running `rake db:migrate` attached to terminal... up, run.7906
  rake aborted!
  ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key
  /app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.28.0/lib/fog/core/service.rb:244:in `validate_options'
  /app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.28.0/lib/fog/core/service.rb:268:in `handle_settings'
  /app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.28.0/lib/fog/core/service.rb:98:in `new'
  /app/vendor/bundle/ruby/2.0.0/gems/fog-core-1.28.0/lib/fog/storage.rb:25:in `new'
  /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:83:in `eager_load_fog'
  /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:96:in `fog_credentials='
  /app/config/initializers/carrier_wave.rb:3:in `block in &lt;top (required)&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave/uploader/configuration.rb:118:in `configure'
  /app/vendor/bundle/ruby/2.0.0/gems/carrierwave-0.10.0/lib/carrierwave.rb:14:in `configure'
  /app/config/initializers/carrier_wave.rb:2:in `&lt;top (required)&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `block in load'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:268:in `load'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:652:in `block in load_config_initializer'
  /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.0/lib/active_support/notifications.rb:166:in `instrument'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:651:in `load_config_initializer'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:616:in `block (2 levels) in &lt;class:Engine&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `each'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/engine.rb:615:in `block in &lt;class:Engine&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `each'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:44:in `tsort_each_child'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
  /app/config/environment.rb:5:in `&lt;top (required)&gt;'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
  /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks'
  Tasks: TOP =&gt; db:migrate =&gt; environment
  (See full trace by running task with --trace)
  </code></pre>