Unable to retrieve Amazon credentials

I am trying to provide credentials for my Spring boot maven application hosted in the cloud (Pivotal Web Services) to download it on Amazon S3. However, every time I try to get credentials using:

DefaultAWSCredentialsProviderChain credentialProviderChain = new DefaultAWSCredentialsProviderChain();
TransferManager transferManager = new TransferManager(credentialProviderChain.getCredentials());

It says

Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception 
[Request processing failed; nested exception is com.amazonaws.AmazonClientException: Unable
to load AWS credentials from any provider in the chain] with root cause
2016-01-28T23:55:38.55+0000 [APP/0]      OUT com.amazonaws.AmazonClientException: 
Unable to load AWS credentials from any provider in the chain

I am a bit confused as to whether my credentials should be defined in the beans.xml or application.properties file. But I tried to do without results. Can someone point me in the right direction?

+4
source share
2 answers

! http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html

AWS, :

  • - AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY (, SDK CLI AWS, .NET) AWS_ACCESS_KEY AWS_SECRET_KEY ( Java SDK).
  • Java - aws.accessKeyId aws.secretKey
  • (~/.aws/credentials), SDK AWS CLI AWS
  • , Amazon EC2

: http://docs.aws.amazon.com/AWSSdkDocsJava/latest/DeveloperGuide/credentials.html

+10

:

$ export AWS_ACCESS_KEY_ID=...
$ export AWS_SECRET_ACCESS_KEY=...
+2

Source: https://habr.com/ru/post/1626459/


All Articles