title: Programatically obtaining the AWS ES endpoint when in VPC
body: <p>I have an Elasticsearch domain in AWS inside a VPC and I need to execute some REST requests against it (my network is set up in such a way that I can do that).</p>
  
  <p>To that end, I would like to ask you guys if there is a way to obtain the Elasticsearch endpoint programatically? I mean, the value of the "VPC endpoint" field in this screen shot <img src="https://www.thecuriousdev.com/images/LogAgg_ES_2.png" alt="screen shot"> for example, but through an AWS CLI or API call rather than through the UI.</p>
  
  <p><code>aws es describe-elasticsearch-domain</code> does not apply, as my domain is inside a vpc.</p>
  
  <p>I have had some success with obtaining the IP address of the network interface, with this command:
  <code>aws ec2 describe-network-interfaces --filters "Name=status,Values=in-use" "Name=description,Values=ES my-es-domain-name" --query "NetworkInterfaces[*].PrivateIpAddress"</code> but it doesn't work with the REST calls (javax.net.ssl.SSLPeerUnverifiedException). </p>
  
  <p>Please help! Thanks!</p>