Enable more stack features: Add Kibana to a deploymentedit

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 beginedit

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.

Stepsedit

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
          }
        }
       ]
      }
    }
    ELASTICSEARCH_CLUSTER_ID
    The Elasticsearch cluster ID as shown in the Cloud UI or obtained via the API.
    KIBANA_INSTANCE_CONFIGURATION_ID
    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"
    }

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.