I’m not happy about putting my credentials in the application.properties file. I’m sure there’s a better way to do this. I looked around and found lots of text but no code of help.
I managed to discover this property to be put in application.properties:
#cloud.aws.credentials.accessKey=XXX
#cloud.aws.credentials.secretKey=XXX
cloud.aws.region.static=us-east-2
cloud.aws.credentials.instanceProfile=true
But I got an error when running this command:
curl -H “Content-Type: text/plain” localhost:8080/generateShortcode -d ‘”https://www.google.co.uk/”‘
{
“timestamp”: “2018-10-16T12:28:53.098+0000”,
“status”: 500,
“error”: “Internal Server Error”,
“message”: “Unable to load AWS credentials from any provider in the chain: [com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@46f388f7: Unable to load credentials from service endpoint, com.amazonaws.auth.profile.ProfileCredentialsProvider@349515a3: No AWS profile named ‘default’]”,
“path”: “/generateShortcode”
}
Google brought me here: https://github.com/aws/aws-sdk-java/issues/1324
SDK has a credential resolution logic to resolve the aws credentials to use when interacting with aws services. See the below link:
http://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/credentials.htmlWhen you see the error “Unable to load AWS credentials from any provider in the chain”, it means we could not find credentials in any of the places the DefaultAWSCredentialsProviderChain looks at. Please make sure the credentials are located at at least one of the places mentioned in the above link.
Urgh, I just put them in… a problem for another day…