How to access Kibana from Amazon elasticsearch service?

前端 未结 5 1491
情深已故
情深已故 2020-12-13 08:38

I created Amazon elasticsearch service and populated data into it using logstash, which has been installed on an EC2 instance. On the Amazon elasticservice console page, the

5条回答
  •  我在风中等你
    2020-12-13 09:14

    In my case, I had an nginx server running which already had access to the elasticsearch service. So all I had to do was to add a proxy on this nginx. No changes in AWS IAM required.

    Add this to /etc/nginx/sites-enabled/elasticsearch

    server {
      listen   7777;
      server_name  127.0.0.1 default_server;
      access_log  /var/log/nginx/elasticsearch.access.log;
      location / {
        auth_basic "My Super Secret Server";
        auth_basic_user_file /etc/nginx/.elasticsearch_htpasswd;
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
            proxy_pass         https://.es.amazonaws.com/;
            proxy_set_header Authorization "";
            proxy_hide_header Authorization;
      }
    }
    

    and restart nginx. Then you can access kibana at:

    http://your_nginx_server_name.com:7777/_plugin/kibana/app/kibana#/dev_tools/console?_g=()
    

    The file /etc/nginx/.elasticsearch_htpasswd is a standard apache2 htaccess file. You can find more about basic auth for nginx here.

    NOTE: Basic auth is NOT a recommended way to secure anything. Definitely don't use this in production.

提交回复
热议问题