Enable more stack features: Add Kibana to a deployment

The RESTful API is also useful for adding Elastic Stack features to existing deployments. In this example, we’ll show you how to create a new Kibana instance and associate it with an existing Elasticsearch cluster that is part of a deployment.

Before you begin

This example requires a deployment with an Elasticsearch cluster to work with that is not being used for anything important. If you don’t already have one, you can follow our My First Deployment example to create one.

Steps

To add a Kibana instance to a deployment:

  1. Create a JSON file with a basic Kibana configuration, here add-kibana.json.

    There are different options you can specify, but the most important one is that you need to include an Elasticsearch cluster ID that the Kibana instance will be associated with and a Kibana instance configuration that tells ECE how to create the new Kibana instance.

    {
     "elasticsearch_cluster_id": "$ELASTICSEARCH_CLUSTER_ID",
      "plan": {
       "kibana": {},
       "cluster_topology": [
        {
          "instance_configuration_id": "$KIBANA_INSTANCE_CONFIGURATION_ID",
          "zone_count": 1,
          "size": {
            "resource": "memory",
            "value": 1024
          }
        }
       ]
      }
    }

    The Elasticsearch cluster ID as shown in the Cloud UI or obtained via the API.

    A Kibana instance configuration ID. On a default ECE installation, you can use kibana.

  2. Issue a POST request to create the new Kibana instance, which returns a new Kibana ID in the response:

    curl -k -X POST -u $USER:$PASSWORD https://$COORDINATOR_HOST:12443/api/v1/clusters/kibana -H 'content-type: application/json' -d @add-kibana.json
    {
      "kibana_cluster_id": "8cffc14c26cb4abe92448603dfc01485"
    }

    A user with sufficient privileges, such as the admin user

    The password for the user

    A host that you installed Elastic Cloud Enterprise on that holds the coordinator role

After the configuration change is complete, your deployment now has a Kibana instance associated with it. If you switch back to the Cloud UI, you can open Kibana to test that it works as expected.