Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Issue passing credential provider for reading amazon s3 data - HDP 2.5.0 (Ambari Managed)

Rising Star


We have a requirement to fetch the data from Amazon s3 and trying to configure hdfs to support that. So far we have configured fs.s3a.secret.key, fs.s3a.access.key these properties and passing credentials as plain text, which works fine. As part of security requirements we are trying to encrypt credentails using Hadoop credentials API, but its failing to read. Getting below error message,

$ hadoop fs -ls s3a://aws-test/testfile.csv

ls: doesBucketExist on wework-mz: com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain: Unable to load AWS credentials from any provider in the chain

Steps done:

hadoop credential create fs.s3a.access.key -provider jceks://hdfs/app/awss3/aws.jceks hadoop credential create fs.s3a.secret.key -provider jceks://hdfs/app/awss3/aws.jceks

$ hadoop credential list -provider jceks://hdfs/app/awss3/aws.jceks Listing aliases for CredentialProvider: jceks://hdfs/app/awss3/aws.jceks fs.s3a.secret.key fs.s3a.access.key

Note: NameNode is in HA



@Saikiran Parepally you have to pass the argument.

Please see my article here:

This property is not supported within core-site.xml. If you set fs.s3a.secret.key and fs.s3a.access.key only and restart HDFS, those credentials will be used. But that means all users have access to the bucket(s) to which these IAM credentials are tied.

The best way to pass credentials using Hadoop credentials API is as follows: hdfs dfs -ls s3a://my-bucket

Rising Star

Thanks @slachterman .. I have followed the same article as mentioned above. From CLI I am able to successfully access s3 buckets by passing But if I configure same in core-site.xml, Hadoop services are failing to start with below error. So I configured fs.s3a.secret.key, fs.s3a.access.key, but getting above mentioned error.

Exception in thread "main" java.lang.StackOverflowError at Method) at at at sun.misc.URLClassPath$FileLoader.getResource( at sun.misc.URLClassPath$FileLoader.findResource( at sun.misc.URLClassPath$ at sun.misc.URLClassPath$1.hasMoreElements( at$3$ at$3$ at Method) at$ at$3.hasMoreElements( at at sun.misc.CompoundEnumeration.hasMoreElements( at java.util.ServiceLoader$LazyIterator.hasNextService( at java.util.ServiceLoader$LazyIterator.hasNext( at java.util.ServiceLoader$1.hasNext( at javax.xml.parsers.FactoryFinder$ at Method) at javax.xml.parsers.FactoryFinder.findServiceProvider( at javax.xml.parsers.FactoryFinder.find( at javax.xml.parsers.DocumentBuilderFactory.newInstance( at org.apache.hadoop.conf.Configuration.loadResource( at org.apache.hadoop.conf.Configuration.loadResources( at org.apache.hadoop.conf.Configuration.getProps( at org.apache.hadoop.conf.Configuration.get( at at at at at at at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>( at org.apache.hadoop.fs.FileSystem$Cache$Key.<init>( at org.apache.hadoop.fs.FileSystem$Cache.get( at org.apache.hadoop.fs.FileSystem.get( at org.apache.hadoop.fs.FileSystem.get( at org.apache.hadoop.fs.Path.getFileSystem( at at<init>( at<init>( at<init>( at$Factory.createProvider( at at org.apache.hadoop.conf.Configuration.getPasswordFromCredentialProviders( at org.apache.hadoop.conf.Configuration.getPassword( at at at org.apache.hadoop.util.ReflectionUtils.setConf( at org.apache.hadoop.util.ReflectionUtils.newInstance( at<init>( at<init>( at at at at at at at or


Please see updated answer and accept if helpful.

Rising Star

Thanks @slachterman .. what is the best way to pass credentials using Hadoop credentials API? As per documentations I have seen, I can pass using, but this parameter is not working.


Please see updated answer.

Rising Star

@slachterman the main reason I want to add credential provider to the hadoop configs is, we are planning to create hive tables on top of s3 data and authorized users (ranger policies) can access that table.

I tried to pass in HiveServer2 connection as parameter, but that is not helping to get access to s3. I am getting below error,

Error: Failed to open new session: org.apache.hive.service.cli.HiveSQLException: java.lang.IllegalArgumentException: Cannot modify at runtime. It is not in list of params that are allowed to be modified at runtime (state=,code=0)

To address above error, I have added to, but still I am getting the same error.


Ok, you've found a new problem. Congratulations. Or commisserations. Filing a bug against that (). the codepath triggering this should only be reached if is set. That should only be needed if you are hoping to provide a specific set of credentials for different buckets, so customising it for the different bucket ( etc. If you have one set of secrets for all S3 buckets, set it in the main config for everything. Which you are trying to on the second attempt. Maybe @lmccay has some suggestion.