简体   繁体   中英

AWS Credentials file not getting picked up by the Provider Chain

I'm having issues getting aws credentials set up on. I'm getting the same issues on MacOSX and CentOS 6.3. I would prefer to keep the credentials in the ~/.aws/credentials file as mentioned in http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/java-dg-setup.html#java-dg-install-sdk but after putting the credentials in the form of

[default]
aws_access_key_id = your_access_key_id
aws_secret_access_key = your_secret_access_key

I get this exception

Exception in thread "main" com.amazonaws.AmazonClientException: Unable to load AWS credentials from any provider in the chain
    at com.amazonaws.auth.AWSCredentialsProviderChain.getCredentials(AWSCredentialsProviderChain.java:77)
    at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:2853)

The java code I am using to set up my s3Client is as follows:

s3Client = new AmazonS3Client(new DefaultAWSCredentialsProviderChain());

Even after setting the credentials file path manually, it's not working either:

export AWS_CREDENTIAL_FILE=/home/myuser/.aws/credentials

Any ideas why this is not working?

Thanks!

Turns out I had an old version of the aws java sdk in my pom file that I forgot to update. Works great since I updated it to the latest.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM