amazon web services - Reading .aws/credentials file with Scala for hadoop conf setting from spark -
how can read different aws profiles have located in credentials
file within .aws
directory? want have app read in access key , secret such below not sure how make point credentials file.
object s3keystore extends serializable { private val keymap = map(string, s3key) def load(key: string)(implicit sc: sparkcontext) = keymap.get(key) match { case some(k) => val hc = sc.hadoopconfiguration hc.set("fs.s3a.awsaccesskeyid", k.access) hc.set("fs.s3a.awssecretaccesskey", k.secret) true case _ => false } }
spark summit automatically set credentials aws env vars; aware can stamp on you've set in spark-defaults/core-site.
if use s3a, think might use credentials (it takes list of auth mechanisms; i'll have see if one).
you can set core-site.xml in hadoop/yarn pick secrets directory. in testing, via xinclude.
s3a in hadoop 2.8+ handle iam auth in ec2 vms, , encoding secrets in encrypted jceks files (which can shared across cluster secrets never sent in clear text in job submission). supports session keys, can issue credentials short period of time.
Comments
Post a Comment