private void setRegion(AmazonWebServiceClient client) {
        if (region != null && endpointConfiguration != null) {
            throw new IllegalStateException("Only one of Region or EndpointConfiguration may be set.");
        }
        if (endpointConfiguration != null) {
            client.setEndpoint(endpointConfiguration.getServiceEndpoint());
            client.setSignerRegionOverride(endpointConfiguration.getSigningRegion());
        } else if (region != null) {
            client.setRegion(region);
        } else {
            final String region = determineRegionFromRegionProvider();
            if (region != null) {
                client.setRegion(getRegionObject(region));
            } else {
                throw new 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.");
            }
        }
    }
@return An instance of AwsSyncClientParams that has all params to be used in the sync client
constructor.
aws-java-sdk-core/src/main/java/com/amazonaws/client/builder/AwsClientBuilder.java