Spring Boot Application fails to start since it fails to load region from system settings when AWS STS module is included


1 min read

Table of contents


When AWS STS module is included in a Spring Boot Application, exception complaining region not set is thrown.

  • Maven pom.xml
  • Error Message
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.

[main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'awsClientBuilderConfigurer' defined in class path resource [io/awspring/cloud/autoconfigure/core/AwsAutoConfiguration.class]:

Unsatisfied dependency expressed through method 'awsClientBuilderConfigurer' parameter 0: Error creating bean with name 'credentialsProvider' defined in class path resource [io/awspring/cloud/autoconfigure/core/CredentialsProviderAutoConfiguration.class]: 

Failed to instantiate [software.amazon.awssdk.auth.credentials.AwsCredentialsProvider]: Factory method 'credentialsProvider' threw exception with message: Unable to load region from any of the providers in the chain software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain@65d26881: 

[software.amazon.awssdk.regions.providers.SystemSettingsRegionProvider@36f9d1c3: Unable to load region from system settings. Region must be specified either via environment variable (AWS_REGION) or  system property (aws.region).,

software.amazon.awssdk.regions.providers.AwsProfileRegionProvider@223459f: No region provided in profile: default, software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider@6b22bd04: Unable to retrieve region information from EC2 Metadata service. Please make sure the application is running on EC2.]


To resolve the problem, in Spring Boot application.yml, configure desired region in cloud.aws.region.static and set cloud.aws.region.auto to false to disable auto-configuration of the region.

    name: my-service
        static: eu-west-2
        auto: false