title: Spring Boot - Spring Cloud AWS : region not found
body: <p>I have a Spring Boot, Spring Cloud AWS service, written to receive messages from an AWS SQS queue. Everything has been working fine within my own personal AWS account services with region set to &quot;us-east-1&quot;, but when switching over to AWS GovCloud region &quot;us-gov-east-1&quot;, receiving error message &quot;The region 'us-gov-east-1' is not a valid region&quot;. Tracked down the problem to be related to pulling a real old version of the aws-java-sdk-core-1.11.415 library that does not contain the new GovCloud region within its Regions.enum object. Not really sure why this project is pulling in a very old transitive dependency of aws-java-sdk-core-1.11.415, as I believe the Spring-Cloud project is set to pull in aws-java-sdk-core-1.11.7xx. Granted, I may have done something wrong in my pom.xml configuration, but I can't seem to figure out why the project is pulling in an old old version of the aws-java-sdk-core library.</p>
  <p>I have been running for intial testing purposes with my default region set to with no problems:</p>
  <pre><code>cloud.aws.region.static=us-east-2
  </code></pre>
  <p>However, we are trying to migrate our Docker container service over to the new AWS GovCloud region:</p>
  <pre><code>cloud.aws.region.static=us-gov-east-1
  </code></pre>
  <p>I am getting the following error during runtime:</p>
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.aws.core.region.StaticRegionProvider]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: The region 'us-gov-east-1' is not a valid region!
  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:217) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
  at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
  at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:310) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
  ... 78 common frames omitted
  Caused by: java.lang.IllegalArgumentException: The region 'us-gov-east-1' is not a valid region!
  at org.springframework.cloud.aws.core.region.StaticRegionProvider.&lt;init&gt;(StaticRegionProvider.java:47) ~[spring-cloud-aws-core-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
  at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
  at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:204) ~[spring-beans-5.2.6.RELEASE.jar!/:5.2.6.RELEASE]
  ... 80 common frames omitted
  Caused by: java.lang.IllegalArgumentException: Cannot create enum from us-gov-east-1 value!
  at com.amazonaws.regions.Regions.fromName(Regions.java:87) ~[aws-java-sdk-core-1.11.415.jar!/:na]
  at org.springframework.cloud.aws.core.region.StaticRegionProvider.&lt;init&gt;(StaticRegionProvider.java:44) ~[spring-cloud-aws-core-2.2.1.RELEASE.jar!/:2.2.1.RELEASE]
  ... 85 common frames omitted
  </code></pre>
  <p>pom.xml configuration file is as follows:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
  xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;2.3.1.RELEASE&lt;/version&gt;
      &lt;relativePath/&gt; &lt;!-- lookup parent from repository --&gt;
  &lt;/parent&gt;
  
  &lt;groupId&gt;com.foo.scout&lt;/groupId&gt;
  &lt;artifactId&gt;scout-s3-sqs&lt;/artifactId&gt;
  &lt;version&gt;0.0.3&lt;/version&gt;
  
  &lt;name&gt;scout-s3-sqs&lt;/name&gt;
  &lt;description&gt;Scout S3&lt;/description&gt;
  
  &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;project.reporting.outputEncoding&gt;UTF-8&lt;/project.reporting.outputEncoding&gt;
      &lt;java.version&gt;11&lt;/java.version&gt;
      &lt;maven.compiler.source&gt;${java.version}&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;${java.version}&lt;/maven.compiler.target&gt;
  
      &lt;docker.image.prefix&gt;foo&lt;/docker.image.prefix&gt;
      &lt;spring-cloud.version&gt;Hoxton.SR5&lt;/spring-cloud.version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter-aws&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
          &lt;artifactId&gt;spring-cloud-starter-aws-messaging&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.kafka&lt;/groupId&gt;
          &lt;artifactId&gt;spring-kafka&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-devtools&lt;/artifactId&gt;
          &lt;scope&gt;runtime&lt;/scope&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-configuration-processor&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
          &lt;artifactId&gt;lombok&lt;/artifactId&gt;
          &lt;optional&gt;true&lt;/optional&gt;
      &lt;/dependency&gt;
  
      &lt;!-- AWS uses JODA DateTime objects --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;joda-time&lt;/groupId&gt;
          &lt;artifactId&gt;joda-time&lt;/artifactId&gt;
          &lt;version&gt;2.10.6&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.datatype&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-datatype-jsr310&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Testing Dependencies --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.junit.vintage&lt;/groupId&gt;
                  &lt;artifactId&gt;junit-vintage-engine&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.kafka&lt;/groupId&gt;
          &lt;artifactId&gt;spring-kafka-test&lt;/artifactId&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.cloud&lt;/groupId&gt;
              &lt;artifactId&gt;spring-cloud-dependencies&lt;/artifactId&gt;
              &lt;version&gt;${spring-cloud.version}&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;com.spotify&lt;/groupId&gt;
              &lt;artifactId&gt;dockerfile-maven-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.4.13&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;repository&gt;${docker.image.prefix}/${project.artifactId}&lt;/repository&gt;
                  &lt;tag&gt;${project.version}&lt;/tag&gt;
                  &lt;buildArgs&gt;
                      &lt;JAR_FILE&gt;target/${project.build.finalName}.jar&lt;/JAR_FILE&gt;
                  &lt;/buildArgs&gt;
                  &lt;pullNewerImage&gt;false&lt;/pullNewerImage&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>Any and all help is appreciated.</p>