[Yandex Cloud documentation](../../../index.md) > [Yandex Compute Cloud](../../index.md) > [Step-by-step guides](../index.md) > Managing an instance group > Configuring application health checks on a VM instance

# Configuring application health checks on a VM instance

By configuring app health checks on a VM instance, you can improve application availability and ensure its responsiveness. Instance Groups will run a check and automatically recover the instance if it fails it. Do not confuse this with a network load balancer [health check](../../../network-load-balancer/concepts/health-check.md). Learn more about automatic recovery and types of checks [here](../../concepts/instance-groups/autohealing.md).

This section describes how to configure an application health check for an existing group.

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), open the folder containing the instance group in question.
  1. Navigate to **Compute Cloud**.
  1. In the left-hand panel, select ![image](../../../_assets/console-icons/layers-3-diagonal.svg) **Instance groups**.
  1. Select the group to update.
  1. In the top-right corner of the page, click **Edit**.
  1. Under **Health checks**, enable **Activate**.
  1. Configure health check settings:
     * **Type**: `HTTP` or `TCP`.
     * **Path** (for HTTP): URL path Instance Groups will use to send HTTP check requests.
     * **Port**: Port in the range of 1 to 32767 Instance Groups will use to send check requests on.

       {% note alert %}

       Only HTTP/1.1 and lower are supported.

       {% endnote %}
     * **Timeout in sec**: Response timeout in seconds.
       If you [connected your group to a network load balancer](create-with-balancer.md), we recommend setting this parameter to a _higher_ value than the one for the load balancer.
     * **Interval in sec**: Interval between app health checks run by Instance Groups, in seconds.
     * **Healthy threshold**: Number of successful health checks required to consider a VM instance healthy.  
        If you connected your group to a network load balancer, we recommend setting this parameter to a _lower_ value than the one for the load balancer.
     * **Unhealthy threshold**: Number of failed health checks required to consider a VM instance unhealthy.
       If you connected your group to a network load balancer, we recommend setting this parameter to a _higher_ value than the one for the load balancer.
  1. Click **Save**.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. See the description of the CLI command for updating a group:

     ```
     yc compute instance-group update --help
     ```
  
  1. Get a list of instance groups in the default folder:

      ```bash
      yc compute instance-group list
      ```
      
      Result:
      
      ```text
      +----------------------+----------------------+--------+------+
      |          ID          |          NAME        | STATUS | SIZE |
      +----------------------+----------------------+--------+------+
      | cl15b3mrkk88******** | first-instance-group | ACTIVE |    3 |
      +----------------------+----------------------+--------+------+
      ```
  1. Select `ID` or `NAME` of the group you need, e.g., `first-instance-group`.
  1. [Get information](get-info.md) about the instance group.
  1. Create a YAML file with any name, e.g., `group.yaml`, and define the following based on the info you get:

      * Instance [template](../../concepts/instance-groups/instance-template.md).
      * [Policies](../../concepts/instance-groups/policies/index.md).
      * Service account ID.
      * Network load balancer specification, if required.

  1. Add a health check specification to the file, e.g, for HTTP checks:

     ```yaml
     ...
     health_checks_spec:
       health_check_specs:
         - http_options:
             port: 80
             path: /
           interval: 30s
           timeout: 10s
           unhealthy_threshold: 5
           healthy_threshold: 3
     ...
     ```

      Where:

      Key | Value
      ----- | -----
      `health_check_specs` | Health check specification
      `http_options` | Settings for HTTP health checks. Only HTTP/1.1 and lower are supported.<br>If you want to use TCP, specify only the port number in the `tcp_options` property.
      `port` | Port in the range of 1 to 32767 Instance Groups will use to send check requests on.
      `path` | URL path Instance Groups will use to send HTTP check requests.
      `interval` | Interval between app health checks run by Instance Groups, in seconds.
      `timeout` | Response timeout in seconds.<br>If you [connected your group to a network load balancer](create-with-balancer.md), we recommend setting this parameter to a _higher_ value than the one for the load balancer.
      `unhealthy_threshold` | Number of failed health checks required to consider a VM instance unhealthy.<br>If you connected your group to a network load balancer, we recommend setting this parameter to a _higher_ value than the one for the load balancer.
      `healthy_threshold` | Number of successful health checks required to consider a VM instance healthy.<br>If you connected your group to a network load balancer, we recommend setting this parameter to a _lower_ value than the one for the load balancer.

  1. Update the instance group in the default folder:

      ```
      yc compute instance-group update --name first-group --file group.yaml
      ```

     Instance Groups will initiate an instance group update.

{% endlist %}