1

All, I am trying to use secrets manager in Spring Boot and Spring Cloud AWS. Here is my application.yml:

cloud:
  aws:
    stack:
      auto: false
    credentials:
      accessKey: ${aws_access_key}
      secretKey: ${aws_secret_key}
      instanceProfile: false
    region:
      static: us-east-1

spring:
  profiles:
    active: 'aws-dev'
  config:
    import: aws-secretsmanager:/dev/onprem/mib-air/backend

aws:
  secretsmanager:
    prefix: /dev/onprem/mib-air
    name: backend
    region: us-east-1

When I start the application I get error:

Caused by: com.amazonaws.SdkClientException: Unable to load AWS credentials from any provider in the chain: [EnvironmentVariableCredentialsProvider: Unable to load AWS credentials from environment variables (AWS_ACCESS_KEY_ID (or AWS_ACCESS_KEY) and AWS_SECRET_KEY (or AWS_SECRET_ACCESS_KEY)),
SystemPropertiesCredentialsProvider: Unable to load AWS credentials from Java system properties (aws.accessKeyId and aws.secretKey),
WebIdentityTokenCredentialsProvider: To use assume role profiles the aws-java-sdk-sts module must be on the class path.,
com.amazonaws.auth.profile.ProfileCredentialsProvider@55ecfe1d: profile file cannot be null,
com.amazonaws.auth.EC2ContainerCredentialsProviderWrapper@5b16b260: Failed to connect to service endpoint: 

It seems, the Spring Boot failing to load AWS access key and secret key despite mentioning them earlier.

Attila T
  • 577
  • 1
  • 4
  • 18
Pavan Jadda
  • 4,306
  • 9
  • 47
  • 79
  • Where are you running your application? If you are on AWS you should rather use an IAM role instead of access keys and secret. – Dennis Kieselhorst Mar 07 '23 at 10:49
  • @DennisKieselhorst I am running this in on prem. See this repo to reproduce the error https://github.com/pavankjadda/springboot-aws-s3-bug – Pavan Jadda Jul 20 '23 at 02:55

0 Answers0