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 resource and associate it with an existing Elasticsearch resource 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 an existing deployment:

  1. Make a PUT request to the deployment that includes this resource.

    There are different options you can specify, but the most important one is that you need to include the ref_id of the Elasticsearch resource that the Kibana instance will be associated with, by using the field elasticsearch_cluster_ref_id.

    curl -k -X PUT -H "Authorization: ApiKey $ECE_API_KEY" https://$COORDINATOR_HOST:12443/api/v1/deployments/$DEPLOYMENT_ID -H 'content-type: application/json' -d '{
        "prune_orphans" : false,
        "resources":{
           "kibana": [{
              "region": "ece-region",
              "ref_id" : "main-kibana",
              "elasticsearch_cluster_ref_id" : "main-elasticsearch",
              "plan": {
                 "cluster_topology": [{
                    "instance_configuration_id": "KIBANA_INSTANCE_CONFIGURATION_ID",
                    "zone_count": 1,
                    "size": {
                         "resource": "memory",
                         "value": 1024
                     }
                 }],
                 "kibana": {
                     "version": "7.5.1"
                 }
             }
          }]
       }
    }'
    DEPLOYMENT_ID
    The deployment ID for My First Deployment
    KIBANA_INSTANCE_CONFIGURATION_ID
    A Kibana instance configuration ID. On a default ECE installation, you can use kibana.
    prune_orphans
    is set to false, because we don’t want to shut down other existing resources not included in this request

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