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
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.