title: How to connect to AWS Elasticsearch using the Elasticsearch JavaScript SDK?
body: <p>I'm using the <strong>AWS Elasticsearch</strong> service and would like to connect via <a href="https://github.com/elastic/elasticsearch-js" rel="noreferrer">elasticsearch.js</a>, but a port is required. </p>
  
  <p>It looks like AWS only offers the <strong>REST API</strong> (e.g. via curl), running on port 80. My cluster is up and I can access via the browser, but not via elasticsearch.js.</p>
  
  <p>This example doesn't work for me:</p>
  
  <pre><code>var elasticsearch = require('elasticsearch');
  var client = new elasticsearch.Client({
    host: 'localhost:9200', // not working: '', 80, default: 443
    log: 'trace'
  });
  
  client.ping({
    requestTimeout: 1000
  }, function (error) {
    if (error) {
      console.trace('elasticsearch cluster is down!');
    } else {
      console.log('All is well');
    }
  });
  </code></pre>
  
  <p>I found <a href="https://github.com/TheDeveloper/http-aws-es" rel="noreferrer">http-aws-es</a>, but it's not working either.</p>
  
  <p>Any idea? Thanks in advance!</p>