Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load AWS credentials from any provider in the chain #213

Closed
DBCerigo opened this issue Oct 5, 2017 · 4 comments
Closed

Unable to load AWS credentials from any provider in the chain #213

DBCerigo opened this issue Oct 5, 2017 · 4 comments

Comments

@DBCerigo
Copy link

DBCerigo commented Oct 5, 2017

Hi,

This may well be a spark issue which doesn't concern flintrock, but it is something that becomes a bit more tricky in flintrock.

I'm trying to use the ID and secret key of an IAM user to authentic pulling data into a cluster from s3. I've confirmed that my ID and secret work when used like sqlCtx.read.csv('s3a://<ID>:<SECRET>@bucket/file.txt).

But I get the Unable to load AWS credentials from any provider in the chain if trying to load the ID and secret dynamically. Ways I've tried getting them to load, all resulting in same mentioned error;
• adding ~/.aws/credentials (and confirming it's found by aws cli using aws configure) to master and slaves
• running !export AWS_ACCESS_KEY_ID=..., and for secret, in Jupyter notebook that is connected to the spark cluster

Suggestions on how you solved this appreciated.
Note: I want to rely solely on the ID and secret key as working in a team and want to easily share bucket access.

Thanks

@nchammas
Copy link
Owner

nchammas commented Oct 5, 2017

Spark doesn't look at ~/.aws/credentials and probably not at the AWS_* environment variables either.

What you need is to use the fs.s3* properties described here, and if you're using Hadoop 2.7+ you should specifically use s3a as opposed to s3n or just s3. I think the settings go in hadoop/conf/core-site.xml.

Better than managing credentials, though, would be if you used IAM roles as described in the README. Then you don't need to specify secrets anywhere.

@DBCerigo
Copy link
Author

DBCerigo commented Oct 5, 2017

In the end I guessed it must not be - though this in combination with

com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:131)

seemed to imply that it should be looking in there which keep me trying for longer - maybe it's not because it's not DefaultAWSCredentialsProviderChain? Anyway!

Do you have a suggestion how to either automatically inject those xml config files, or to "bake" them into the ami without clashing with flintrock's setup process?

I'm finding using flintrock great because it's so speedy, and I'm avoiding (almost) all extra cluster setup steps to keep it speedy by having everything else already setup on a custom ami.

@nchammas
Copy link
Owner

nchammas commented Oct 5, 2017

The easiest thing to do is use flintrock run-command to inject the configs into the appropriate files, though the commands will be clunky (you'll probably need to use sed or something similar).

My recommended solution is to not use credentials at all and instead use IAM roles.

A potential future solution is coming in #202, where you'll be able to bring your own templates and have Flintrock use them during launch.

@DBCerigo
Copy link
Author

DBCerigo commented Oct 5, 2017

Ok, that's helpful thanks, and #202 looks great, hoping it gets merged!

@DBCerigo DBCerigo closed this as completed Oct 5, 2017
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

No branches or pull requests

2 participants