Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon
Labs

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

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Advanced
Duration
Clock icon 2h 0m
Published
Clock icon Jan 10, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. 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"]}]}'
    
  2. 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"]}]}'
    
  3. 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"]}]}'
    
  4. 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"}'
    
  5. 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"}'
    
  6. 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"}'
    

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans