title: Spark Scala S3 storage: permission denied
body: <p>I've read a lot of topic on Internet on how to get working Spark with S3 still there's nothing working properly.
  I've downloaded : <a href="https://www.apache.org/dyn/closer.lua/spark/spark-2.3.2/spark-2.3.2-bin-hadoop2.7.tgz" rel="nofollow noreferrer">Spark 2.3.2 with hadoop 2.7 and above</a>.   </p>
  
  <p>I've copied only some libraries from Hadoop 2.7.7 (which matches Spark/Hadoop version) to Spark jars folder:  </p>
  
  <ul>
  <li>hadoop-aws-2.7.7.jar</li>
  <li>hadoop-auth-2.7.7.jar</li>
  <li>aws-java-sdk-1.7.4.jar</li>
  </ul>
  
  <p>Still I can't use nor S3N nor S3A to get my file read by spark: </p>
  
  <p>For S3A I have this exception: </p>
  
  <pre><code>sc.hadoopConfiguration.set("fs.s3a.access.key","myaccesskey")
  sc.hadoopConfiguration.set("fs.s3a.secret.key","mysecretkey")
  val file = sc.textFile("s3a://my.domain:8080/test_bucket/test_file.txt")
  com.amazonaws.services.s3.model.AmazonS3Exception: Status Code: 403, AWS Service: Amazon S3, AWS Request ID: AE203E7293ZZA3ED, AWS Error Code: null, AWS Error Message: Forbidden
  </code></pre>
  
  <p>Using this <a href="https://codereview.stackexchange.com/q/92291/182059">piece of Python</a>, and some more code, I can list my buckets, list my files, download files, read files from my computer and get file url. 
  This code gives me the following file url:  </p>
  
  <p><a href="https://my.domain:8080/test_bucket/test_file.txt?Signature=%2Fg3jv96Hdmq2450VTrl4M%2Be%2FI%3D&amp;Expires=1539595614&amp;AWSAccessKeyId=myaccesskey" rel="nofollow noreferrer">https://my.domain:8080/test_bucket/test_file.txt?Signature=%2Fg3jv96Hdmq2450VTrl4M%2Be%2FI%3D&amp;Expires=1539595614&amp;AWSAccessKeyId=myaccesskey</a></p>
  
  <p>How should I install / set up / download to get spark able to read and write from my S3 server ?  </p>
  
  <p><strong>Edit 3:</strong>  </p>
  
  <p>Using <a href="https://github.com/steveloughran/cloudstore" rel="nofollow noreferrer">debug tool in comment</a> here's <a href="https://justpaste.it/5l7yf" rel="nofollow noreferrer">the result</a>.<br>
  Seems like the issue is with a signature thing not sure what it means.</p>