title: Not able to write Spark SQL DataFrame to S3
body: <p>I have installed spark 2.0 on EC2 &amp; I am using SparkSQL using Scala to retrieve records from DB2 &amp; I want to write to S3, where I am passing access keys to the Spark Context..Following is my code :</p>
  
  <pre><code>val df = sqlContext.read.format("jdbc").options(Map( "url" -&gt; , "user" -&gt; usernmae, "password" -&gt; password, "dbtable" -&gt; tablename, "driver" -&gt; "com.ibm.db2.jcc.DB2Driver")).option("query", "SELECT * from tablename limit 10").load()
  df.write.save("s3n://data-analytics/spark-db2/data.csv")
  </code></pre>
  
  <p>And it is throwing following exception :</p>
  
  <pre><code>org.apache.hadoop.fs.s3.S3Exception: org.jets3t.service.S3ServiceException: Service Error Message. -- ResponseCode: 403, ResponseStatus: Forbidden, XML Error Message: &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;Error&gt;&lt;Code&gt;AccessDenied&lt;/Code&gt;&lt;Message&gt;Access Denied&lt;/Message&gt;&lt;RequestId&gt;1E77C38FA2DB34DA&lt;/RequestId&gt;&lt;HostId&gt;V4O9sdlbHwfXNFtoQ+Y1XYiPvIL2nTs2PIye5JBqiskMW60yDhHhnBoCHPDxLnTPFuzyKGh1gvM=&lt;/HostId&gt;&lt;/Error&gt;
  Caused by: org.jets3t.service.S3ServiceException: Service Error Message.
    at org.jets3t.service.S3Service.putObject(S3Service.java:2358)
    at org.apache.hadoop.fs.s3native.Jets3tNativeFileSystemStore.storeEmptyFile(Jets3tNativeFileSystemStore.java:162)
  </code></pre>
  
  <p>What is the exact problem occurring here as I am passing the Access Keys also to Sparkcontext ?? Any other way to write to S3??</p>