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

Search for a command to run...

No comments yet. Be the first to comment.
Log the problems I'd encountered during programming, and log my solution to resolve the problem.
Problem [ERROR] Failed to execute goal on project room-data-generator: Could not resolve dependencies for project dev.adafycheng:hello-world:jar:0.0.1-SNAPSHOT: Failure to find org.codehaus.groovy:groovy-all:jar:2.5.17 in https://packages.confluent.i...
In this article, we'll write a JUnit Test configured with Environment Variables using junit-pioneer library. First of all, we need to add the junit-pioneer library and maven-surefire-plugin to the Maven pom.xml. <project> <properties> <p...
Problem The problem occurs when using the Python requests library, the chardet library is not installed. /Users/adacheng/Library/Python/3.9/lib/python/site-packages/requests/__init__.py:86: RequestsDependencyWarning: Unable to find acceptable charact...

Apache Kafka is an open-source distributed event streaming platform for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications. Introduction This article aims to provide basic hands-on instructions ...

Installation Follow the instruction in this article to install Trivy. Scan To scan the docker image: Build the image. docker build . -t hello-world Scan the image. trivy scan hello-world

When AWS STS module is included in a Spring Boot Application, exception complaining region not set is thrown.
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sts</artifactId>
</dependency>
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.
spring:
application:
name: my-service
cloud:
aws:
region:
static: eu-west-2
auto: false