Skip to content

Add support for 'credential_process' profile attribute. - #1835

Closed
millems wants to merge 1 commit into
masterfrom
preview/credential-process-support
Closed

millems wants to merge 1 commit into
masterfrom
preview/credential-process-support

Conversation

@millems

@millems millems commented Dec 12, 2018

Copy link
Copy Markdown
Contributor

No description provided.

@millems
millems force-pushed the preview/credential-process-support branch from 9661eff to 89d9618 Compare December 12, 2018 01:54
@tyehle

tyehle commented Jan 5, 2019

Copy link
Copy Markdown

I'd love to see this merged :)

@copumpkin

Copy link
Copy Markdown

Same! @dagnir @varunnvs92 as folks who seem to be active and merging PRs, could you take a look at this?

aws-cli/botocore/boto3 have had support for this feature for a while, and the Go SDK grew support for it in December. See also discussion on V2 here. This seems worth standardizing across the SDKs because it's extremely useful.

@millems

millems commented Jan 17, 2019

Copy link
Copy Markdown
Contributor Author

This is planned for merger in the future. We're just pending testing it on more platforms, like Windows.

@meatheadmike

Copy link
Copy Markdown

I tried setting this up in Spark as it uses aws-sdk-java and our company uses credential_process. My hope was that this would just work "as is" on Spark and Hadoop.

Credentials provider was set up as follows:
--conf spark.hadoop.fs.s3a.aws.credentials.provider=com.amazonaws.auth.ProcessCredentialsProvider

However I get the following error after trying to connect to an S3 resource:

  File "<stdin>", line 1, in <module>
  File "/opt/spark/2.3/python/pyspark/sql/readwriter.py", line 328, in text
    return self._df(self._jreader.text(self._spark._sc._jvm.PythonUtils.toSeq(paths)))
  File "/opt/spark/2.3/python/lib/py4j-0.10.7-src.zip/py4j/java_gateway.py", line 1257, in __call__
  File "/opt/spark/2.3/python/pyspark/sql/utils.py", line 63, in deco
    return f(*a, **kw)
  File "/opt/spark/2.3/python/lib/py4j-0.10.7-src.zip/py4j/protocol.py", line 328, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o55.text.
: java.io.IOException: com.amazonaws.auth.ProcessCredentialsProvider constructor exception.  A class specified in fs.s3a.aws.credentials.provider must provide a public constructor accepting Configuration, or a public factory method named getInstance that accepts no arguments, or a public default constructor.
	at org.apache.hadoop.fs.s3a.S3AUtils.createAWSCredentialProvider(S3AUtils.java:415)
	at org.apache.hadoop.fs.s3a.S3AUtils.createAWSCredentialProviderSet(S3AUtils.java:351)
	at org.apache.hadoop.fs.s3a.S3ClientFactory$DefaultS3ClientFactory.createS3Client(S3ClientFactory.java:73)
	at org.apache.hadoop.fs.s3a.S3AFileSystem.initialize(S3AFileSystem.java:186)
	at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:2812)
	at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:100)
	at org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:2849)
	at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:2831)
	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:389)
	at org.apache.hadoop.fs.Path.getFileSystem(Path.java:356)
	at org.apache.spark.sql.execution.datasources.DataSource$.org$apache$spark$sql$execution$datasources$DataSource$$checkAndGlobPathIfNecessary(DataSource.scala:705)
	at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$15.apply(DataSource.scala:389)
	at org.apache.spark.sql.execution.datasources.DataSource$$anonfun$15.apply(DataSource.scala:389)
	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
	at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
	at scala.collection.immutable.List.foreach(List.scala:381)
	at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
	at scala.collection.immutable.List.flatMap(List.scala:344)
	at org.apache.spark.sql.execution.datasources.DataSource.resolveRelation(DataSource.scala:388)
	at org.apache.spark.sql.DataFrameReader.loadV1Source(DataFrameReader.scala:239)
	at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:227)
	at org.apache.spark.sql.DataFrameReader.text(DataFrameReader.scala:693)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:244)
	at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:357)
	at py4j.Gateway.invoke(Gateway.java:282)
	at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
	at py4j.commands.CallCommand.execute(CallCommand.java:79)
	at py4j.GatewayConnection.run(GatewayConnection.java:238)
	at java.lang.Thread.run(Thread.java:748)

Am I doing something wrong, or is this missing something?

@meatheadmike

meatheadmike commented Jan 17, 2019 •

Copy link
Copy Markdown

So to answer my own question, the correct setting was:

--conf spark.hadoop.fs.s3a.aws.credentials.provider=com.amazonaws.auth.profile.ProfileCredentialsProvider

Now it runs correctly.

@meatheadmike

Copy link
Copy Markdown

Bug report: "Expiration": "2019-01-18T00:03:29+00:00" is not processed correctly (despite it being valid ISO8601)

@tahoward

tahoward commented Apr 2, 2019

Copy link
Copy Markdown

Be great to get this merged!

@meatheadmike

meatheadmike commented Apr 3, 2019 via email

Copy link
Copy Markdown

@zoewangg

zoewangg commented Apr 3, 2019

Copy link
Copy Markdown
Contributor

Sorry for the late notice, but the PR was merged internally a couple of months ago.

Credential process is supported since version 1.11.489
https://github.com/aws/aws-sdk-java/blob/master/CHANGELOG.md#111489-2019-01-24

Closing this stale PR.

@zoewangg zoewangg closed this Apr 3, 2019
@zoewangg
zoewangg deleted the preview/credential-process-support branch April 3, 2019 16:38
@zoewangg
zoewangg restored the preview/credential-process-support branch April 3, 2019 16:38
@millems
millems deleted the preview/credential-process-support branch January 22, 2021 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants