private boolean isMetadataServiceEndpoint(String host) {
            String mode = System.getenv(AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE);
            if ("IPV6".equalsIgnoreCase(mode)) {
                return VALID_LOOP_BACK_IPV6.contains(host);
            }
            return VALID_LOOP_BACK_IPV4.contains(host);
        }
Determines if the addresses for a given host are resolved to a loopback address.
<p>
    This is a best-effort in determining what address a host will be resolved to. DNS caching might be disabled,
    or could expire between this check and when the API is invoked.
</p>
@param host The name or IP address of the host.
@return A boolean specifying whether the host is allowed as an endpoint for credentials loading.
aws-java-sdk-core/src/main/java/com/amazonaws/auth/ContainerCredentialsProvider.java