<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Murat Bastas</title>
    <description>The latest articles on DEV Community by Murat Bastas (@murat).</description>
    <link>https://dev.to/murat</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F136669%2Fa0c70758-d57f-48a3-8755-cbb1d53814fb.jpeg</url>
      <title>DEV Community: Murat Bastas</title>
      <link>https://dev.to/murat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/murat"/>
    <language>en</language>
    <item>
      <title>How to connect to AWS Elasticsearch cluster from outside of the VPC</title>
      <dc:creator>Murat Bastas</dc:creator>
      <pubDate>Wed, 20 Nov 2019 09:44:38 +0000</pubDate>
      <link>https://dev.to/murat/how-to-connect-to-aws-elasticsearch-cluster-from-outside-of-the-vpc-5kb</link>
      <guid>https://dev.to/murat/how-to-connect-to-aws-elasticsearch-cluster-from-outside-of-the-vpc-5kb</guid>
      <description>&lt;h3&gt;
  
  
  1. Make a tunnel to an EC2 instance that is in the same VPC
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh &lt;span class="nt"&gt;-fN&lt;/span&gt; &lt;span class="nt"&gt;-L&lt;/span&gt; 9200:youresclusteraddress:443 user@host
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It may look ugly, so you can add this to &lt;code&gt;~/.ssh/config&lt;/code&gt; file; add the following content to the file by &lt;code&gt;vim ~/.ssh/config&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Host myestunnel
  HostName host
  User user
  IdentitiesOnly yes
  IdentityFile ~/.ssh/sshkeyfile
  LocalForward 9200 youresclusteraddress:443
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And then run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ssh myestunnel &lt;span class="nt"&gt;-fN&lt;/span&gt; &lt;span class="c"&gt;# with -f for "fork into background" and -N for "run no command"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Check the connection by:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-k&lt;/span&gt; https://localhost:9200/_cat/health
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Or open &lt;a href="https://localhost:9200/_cat/health"&gt;&lt;code&gt;https://localhost:9200/_cat/health&lt;/code&gt;&lt;/a&gt; in browser.&lt;/p&gt;

&lt;p&gt;If you see something like this (&lt;code&gt;1574240905 01:08:25 846366659123:clustername green 2 5 4 6 0 0 0 0 - 100.0%&lt;/code&gt;) that means it's working well.&lt;/p&gt;

&lt;p&gt;You may see this, just trust it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RkIwnbwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3xfqkfq0tbzzn0b1xfxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RkIwnbwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3xfqkfq0tbzzn0b1xfxp.png" alt="trust"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Use a beautiful GUI for querying and manage your cluster
&lt;/h3&gt;

&lt;p&gt;There are some &lt;a href="https://www.slant.co/topics/11537/~elasticsearch-gui-clients"&gt;GUI applications for Elasticsearch&lt;/a&gt;. I like only one of them, it's &lt;a href="https://github.com/lmenezes/cerebro"&gt;&lt;code&gt;cerebro&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  2.1 Install cerebro
&lt;/h4&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;wget https://github.com/lmenezes/cerebro/releases/download/v0.8.5/cerebro-0.8.5.zip
unzip cerebro-0.8.5.zip &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;mv &lt;/span&gt;cerebro-0.8.5 cerebro &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nb"&gt;cd &lt;/span&gt;cerebro
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;bin/cerebro &lt;span class="nt"&gt;-Dhttp&lt;/span&gt;.port&lt;span class="o"&gt;=&lt;/span&gt;9201 &lt;span class="nt"&gt;-Dhttp&lt;/span&gt;.address&lt;span class="o"&gt;=&lt;/span&gt;127.0.0.1 &lt;span class="nt"&gt;-Dplay&lt;/span&gt;.ws.ssl.loose.acceptAnyCertificate&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;true&lt;/span&gt; &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt; &lt;code&gt;play.ws.ssl.loose.acceptAnyCertificate=true&lt;/code&gt; means no verify SSL.&lt;/p&gt;

&lt;p&gt;Open &lt;a href="http://localhost:9201"&gt;localhost:9201&lt;/a&gt; and connect to &lt;a href="https://localhost:9200"&gt;https://localhost:9200&lt;/a&gt;&lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>aws</category>
      <category>cerebro</category>
    </item>
  </channel>
</rss>
