- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud

Configure User Access Control for Elasticsearch
To enforce data confidentiality and maintain user accessibility with Elasticsearch, we need to know how to create custom roles and users. In this hands-on lab, we go through the following tasks on a single-node Elasticsearch cluster, using either Kibana or `curl` on the command line: * Create custom roles * Create users

Lab Info
Table of Contents
-
Challenge
Create the sample_read Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_read { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_read?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read"]}]}'
-
Challenge
Create the sample_write Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_write { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read", "write" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_write?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","write"]}]}'
-
Challenge
Create the sample_monitor Role
Use the Kibana console tool to execute the following:
POST _security/role/sample_monitor { "indices": [ { "names": [ "sample-*" ], "privileges": [ "read", "monitor" ] } ] }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/role/sample_monitor?pretty" -H 'Content-Type: application/json' -d'{"indices":[{"names":["sample-*"],"privileges":["read","monitor"]}]}'
-
Challenge
Create the john User
Use the Kibana console tool to execute the following:
POST _security/user/john { "roles": [ "kibana_user", "sample_read" ], "full_name": "John Doe", "email": "[email protected]", "password": "john_123" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/john?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_read"],"full_name":"John Doe","email":"[email protected]","password":"john_123"}'
-
Challenge
Create the jane User
Use the Kibana console tool to execute the following:
POST _security/user/jane { "roles": [ "kibana_user", "sample_write" ], "full_name": "Jane Doe", "email": "[email protected]", "password": "jane_456" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/jane?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_write"],"full_name":"Jane Doe","email":"[email protected]","password":"jane_456"}'
-
Challenge
Create the noc User
Use the Kibana console tool to execute the following:
POST _security/user/noc { "roles": [ "kibana_user", "sample_monitor", "monitoring_user" ], "full_name": "Network Operations Center", "email": "[email protected]", "password": "noc_789" }
Or, use command-line
curl
on any one of the nodes via ssh:curl -k -u elastic:la_elastic_409 -XPOST "http://localhost:9200/_security/user/noc?pretty" -H 'Content-Type: application/json' -d'{"roles":["kibana_user","sample_monitor","monitoring_user"],"full_name":"Network Operations Center","email":"[email protected]","password":"noc_789"}'
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.