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, there will be a link to access Kibana.
search-cluster_name-XXXXXXXXXXXXXXXXXXX.region_name.es.amazonaws.com/_plugin/kibana/
when I click the link, browser is throwing the following error.
{"Message":"User: anonymous is not authorized to perform: es:ESHttpGet on resource: arn:aws:es:region_name:account_id:domain/cluster_name/_plugin/kibana/"}
I'm sure that this has something related with access policy of ES domain.How should I modify my access policy so that I can access Kibana from a click on the link specified ?
You can setup an Access Policy with both IAM and IP-address based access. See my answer here. In short:
arn:aws:iam::aws:policy/AmazonESFullAccess
policyHere's an example policy (statement order is important!)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::xxxxxxxxxxxx:root"
},
"Action": "es:*",
"Resource": "arn:aws:es:us-west-2:xxxxxxxxxxxx:domain/my-elasticsearch-domain/*"
},
{
"Sid": "",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws:es:us-west-2:xxxxxxxxxxxx:domain/my-elasticsearch-domain/*",
"Condition": {
"IpAddress": {
"aws:SourceIp": [
"192.168.1.0",
"192.168.1.1"
]
}
}
}
]
}
I used for that purpose proxy tool called aws-es-kibana. It signs all your requests sent to aws kibana.
IAM configuration:
I created new IAM user "elasticsearch_user" with programmatic access (and I got accessKeyId and secretAccessKey associated with that account).
Elasticsearch configuration:
I created elasticsearch policy that enables access for the new created IAM user:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::{YOUR_AWS_ACCOUNT_ID}:user/elasticsearch_user"
]
},
"Action": "es:*",
"Resource": "arn:aws:es:eu-central-1:{YOUR_AWS_ACCOUNT_ID}:domain/{YOUR_ELASTICSEARCH_DOMAIN}/*"
}
]
}
Connect to kibana from your local station:
To connect from my local station (windows) to kibana I just need to type in console:
SET AWS_ACCESS_KEY_ID=myAccessKeyId
SET AWS_SECRET_ACCESS_KEY=mySecretAccessKey
aws-es-kibana search-{PROTECTED_PART_OF_YOUR_ELASTICSEARCH_ENDPOINT}.eu-central-1.es.amazonaws.com
After that you should have proxied access to your kibana under: http://127.0.0.1:9200/_plugin/kibana
You have to configure an access policy for your elasticsearch cluster. there are two options:
Option 1, using IAM based access is the better option:
kibana_user
with programmatic access. Save the accessKeyId and the secretAccessKey. Also copy the user's ARN. kibana_user
.
kibana_user
I seriously recommend against the second option with IP-based access. Even if you have a static IP,
The only case where this makes sense is if you are running your own proxy server with its own authentication method and a static IP.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With