title: How to get AWS EMR cluster id and step id from inside the spark application step submitted
body: <p>Scenario:<br />
  I am running the Spark Scala job in AWS EMR. Now my job dumps some metadata unique to that application. Now for dumping I am writing at location &quot;s3://bucket/key/&lt;APPLICATION_ID&gt;&quot; Where ApplicationId is <code> val APPLICATION_ID: String = getSparkSession.sparkContext.getConf.getAppId</code></p>
  <p>Now basically is there a way to write at s3 location something like &quot;s3://bucket/key/&lt;emr_cluster_id&gt;_&lt;emr_step_id&gt;&quot;.
  How can i get the cluster id and step id from inside the spark Scala application.</p>
  <p>Writing in this way will help me debug and help me in reaching the cluster based and debug the logs.</p>
  <p>Is there any way other than reading the &quot;/mnt/var/lib/info/job-flow.json&quot;  ?</p>
  <p>PS: I am new to spark, scala and emr . Apologies in advance if this is an obvious query.</p>