David A Good

How to Configure AWS Credentials and Region in Spring Cloud AWS

April 30, 2021

When using Spring Cloud AWS, getting the AWS credentials and region configuration properties right can be tricky.

The preferred option is to use the AWS Default Credential Provider Chain and Default Region Provider Chain which results in the required properties being sourced just like the AWS SDK does by default.

cloud:
  aws:
    stack:
      auto: false
    region:
      auto: true
      use-default-aws-region-chain: true
    credentials:
      use-default-aws-credentials-chain: true

Alternatively, you can manually configure the required properties directly in your application properties like this:

cloud:
  aws:
    stack:
      auto: false
    region:
       auto: false
       static: <region-here>
    credentials:
       access-key: <access-key-here>
       secret-key: <secret-key-here>

Software engineer crafting full-stack, cloud-native solutions for enterprise. GitHub | LinkedIn | Twitter