title: Aws::S3::Errors::AccessDenied: Access Denied
body: <p>I am trying to upload files to S3 using Aws-S3 gem. </p>
  
  <pre><code>s3 = Aws::S3::Resource.new(
   credentials: Aws::Credentials.new('XXX', 'XXX'),  
  region: 'us-east-1') 
  
  obj = s3.bucket('bucket-name').object('key')
  
  obj.upload_file('/Users/saghosh/Downloads/projecttimeline_Dec 2017_MajorprojectN.pdf',acl:'public-read')
  </code></pre>
  
  <p>But every time it's giving me 
  Aws::S3::Errors::AccessDenied: Access Denied.</p>
  
  <p>But if I am trying to give </p>
  
  <pre><code>s32 = Aws::S3::Client.new(
    access_key_id: 'XXX',
    secret_access_key: 'XXX',
    region: 'us-east-1'
  )
   s32.list_objects({bucket: 'bucket-name'})
  </code></pre>
  
  <p>it's working fine and listing all my manually uploaded file.
  It seems like a permission issue but not able to figure it out where the problem is?</p>