private String determineRegionFromRegionProvider() {
        try {
            return regionProvider.getRegion();
        }
        catch (SdkClientException e) {
            // The AwsRegionProviderChain that is used by default throws an exception instead of returning null when
            // the region is not defined. For that reason, we have to support both throwing an exception and returning
            // null as the region not being defined.
            return null;
        }
    }
Attempt to determine the region from the configured region provider. This will return null in the event that the
region provider could not determine the region automatically.
aws-java-sdk-core/src/main/java/com/amazonaws/client/builder/AwsClientBuilder.java