title: Unable to find a region via the region provider chain error when getting AmazonS3
body: <p>I have below method to return AmazonS3 for upload documents. In local env, I have to connect to a s3 bucket in a different region but in other environments the s3 bucket and the application code is same aws region.</p>
  
  <pre><code> public AmazonS3 getAmazonS3Client() {
          if ("local".equals(hostEnvironment)) {
              final AssumeRoleRequest roleRequest = new AssumeRoleRequest()
                      .withRoleArn("arnrole").withRoleSessionName("s3Session");
              final AssumeRoleResult assumeRoleResult = AWSSecurityTokenServiceAsyncClientBuilder.defaultClient()
                      .assumeRole(roleRequest);    
              final Credentials sessionCredentials = assumeRoleResult.getCredentials();
              final BasicSessionCredentials basicSessionCredentials = new BasicSessionCredentials(
                      sessionCredentials.getAccessKeyId(), sessionCredentials.getSecretAccessKey(),
                      sessionCredentials.getSessionToken());
              return AmazonS3Client.builder().withRegion("us-east-2").withCredentials
              (new AWSStaticCredentialsProvider(basicSessionCredentials)).build();
          } else {
              return AmazonS3Client.builder().withRegion("us-east-2").withCredentials
                      (new InstanceProfileCredentialsProvider(true)).build();
          }    
      }
  </code></pre>
  
  <p>I am getting below exception when running from local, what am I missing here?</p>
  
  <blockquote>
    <p>Caused by: com.amazonaws.SdkClientException: Unable to find a region
    via the region provider chain. Must provide an explicit region in the
    builder or setup environment to supply a region.  at
    com.amazonaws.client.builder.AwsClientBuilder.setRegion(AwsClientBuilder.java:462)
      at
    com.amazonaws.client.builder.AwsClientBuilder.configureMutableProperties(AwsClientBuilder.java:424)
      at
    com.amazonaws.client.builder.AwsAsyncClientBuilder.build(AwsAsyncClientBuilder.java:80)
      at
    com.amazonaws.services.securitytoken.AWSSecurityTokenServiceAsyncClientBuilder.defaultClient(AWSSecurityTokenServiceAsyncClientBuilder.java:45)</p>
  </blockquote>