[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Apache Kafka®](../index.md) > [Step-by-step guides](index.md) > Clusters > Updating cluster settings

# Updating Apache Kafka® cluster settings


After creating a Managed Service for Apache Kafka® cluster, you can:

* [Change the cluster name and description](#change-name-and-description)
* [Change the class and number of broker hosts](#change-brokers)
* [Change the ZooKeeper host class](#change-zookeeper)
* [Change the KRaft host class](#change-kraft)
* [Change security group and public access settings](#change-sg-set)
* [Change additional cluster settings](#change-additional-settings)
* [Change Apache Kafka® settings](#change-kafka-settings)
* [Move the cluster to another folder](#move-cluster)

Learn more about other cluster updates:

* [Apache Kafka® version update](cluster-version-update.md).
* [Managing disk space in a Managed Service for Apache Kafka® cluster](storage-space.md).
* [Migrating Apache Kafka® cluster hosts to a different availability zone](host-migration.md).
* [Kafka UI web interface for Apache Kafka®](kafka-ui-enable.md).

## Changing a cluster name and description {#change-name-and-description}

{% list tabs group=instructions %}

- Management console {#console}

    1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
    1. Navigate to **Managed Service for&nbsp;Kafka**.
    1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
    1. Under **Basic parameters**, enter a new name and description for the cluster.
    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.

    To change the cluster name and description:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-kafka cluster update --help
        ```

    1. Run this command, specifying the new cluster name and description:

        ```bash
        yc managed-kafka cluster update <cluster_name_or_ID> \
          --new-name <new_cluster_name> \
          --description <new_cluster_description>
        ```

        To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    {% note alert %}

    Do not change the cluster name using Terraform. This will delete the existing cluster and create a new one.

    {% endnote %}

    To update the cluster description:

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. Update the `description` value in the Managed Service for Apache Kafka® cluster description:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          name        = "<cluster_name>"
          description = "<new_cluster_description>"
          ...
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "name,description",
                      "name": "<cluster_name>",
                      "description": "<new_cluster_description>"
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

            Specify the relevant parameters:
            * `name`: To change the cluster name.
            * `description`: To change the cluster description.
        * `name`: New cluster name.
        * `description`: New cluster description.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/Cluster/update.md#responses) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [
                      "name",
                      "description"
                    ]
                  },
                  "name": "<cluster_name>",
                  "description": "<new_cluster_description>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.kafka.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Specify the relevant parameters:
            * `name`: To change the cluster name.
            * `description`: To change the cluster description.
        * `name`: New cluster name.
        * `description`: New cluster description.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing a class and number of broker hosts {#change-brokers}

You can increase the number of [broker hosts](../concepts/brokers.md) if the following conditions are met:

* The cluster uses Apache Kafka® with ZooKeeper. You cannot change the number of broker hosts in Apache Kafka® clusters that use the [KRaft protocol](../concepts/kraft.md).
* The cluster contains at least two broker hosts in different availability zones.

You cannot reduce the number of broker hosts. To comply with cluster [high availability conditions](../concepts/ha-cluster.md), at least three broker hosts are required.

When changing the broker host class:

* A single-broker cluster will be unavailable for a few minutes with topic connections dropped.
* In a multi-broker cluster, each host will be stopped and updated one by one, remaining unavailable for a few minutes.

We recommend changing broker host class only when your cluster has no active workload.

{% list tabs group=instructions %}

- Management console {#console}

  To change the class and number of hosts:

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Change the relevant settings:
     * To update the broker host class, select a new [**Host class**](../concepts/instance-types.md).
     * Change the **Number of brokers in zone**.

  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.

  To change the class and number of hosts:

  1. Get information about the cluster:

     ```bash
     yc managed-kafka cluster list
     yc managed-kafka cluster get <cluster_name_or_ID>
     ```

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-kafka cluster update --help
     ```

  1. To increase the number of broker hosts, run this command:

     ```bash
     yc managed-kafka cluster update <cluster_name_or_ID> --brokers-count <number>
     ```

  1. To change the [broker host class](../concepts/instance-types.md), run this command:

     ```bash
     yc managed-kafka cluster update <cluster_name_or_ID> --resource-preset <host_class>
     ```

  To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. In the Managed Service for Apache Kafka® cluster description, edit the `brokers_count` parameter value to increase the number of broker hosts:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          config {
            brokers_count = <number_of_broker_hosts>
            ...
          }
          ...
        }
        ```

    1. In the Managed Service for Apache Kafka® cluster description, edit the `resource_preset_id` parameter value in the `kafka.resources` section to specify a new [broker host class](../concepts/instance-types.md):

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          kafka {
            resources {
              resource_preset_id = "<broker_host_class>"
              ...
            }
          }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Get the list of available host classes:

        1. Call the [ResourcePreset.list](../api-ref/ResourcePreset/list.md) method, e.g., via the following [cURL](https://curl.se/) request:

            ```bash
            curl \
                --request GET \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/resourcePresets'
            ```

        1. Check the [server response](../api-ref/ResourcePreset/list.md#responses) to make sure your request was successful.

    1. Change the class and number of broker hosts as appropriate:

        1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
            
            {% endnote %}

            ```bash
            curl \
                --request PATCH \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --header "Content-Type: application/json" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
                --data '{
                          "updateMask": "configSpec.kafka.resources.resourcePresetId,configSpec.brokersCount",
                          "configSpec": {
                            "kafka": {
                              "resources": {
                                "resourcePresetId": "<broker_host_class_ID>"
                              }
                            },
                            "brokersCount": "<number_of_broker_hosts>"
                          }
                        }'
            ```

            Where:

            * `updateMask`: Comma-separated string of settings you want to update.

                Specify the relevant parameters:
                * `configSpec.kafka.resources.resourcePresetId`: To change the broker host class.
                * `configSpec.brokersCount`: To change the number of broker hosts.

            You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/Cluster/update.md#responses) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Get the list of available host classes:

        1. Call the [ResourcePresetService/List](../api-ref/grpc/ResourcePreset/list.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/resource_preset_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ResourcePresetService.List
            ```

        1. Check the [server response](../api-ref/grpc/ResourcePreset/list.md#yandex.cloud.mdb.kafka.v1.ListResourcePresetsResponse) to make sure your request was successful.

    1. Change the host class as appropriate:

        1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
            
            {% cut "Format for listing settings" %}
            
            ```yaml
            "update_mask": {
                "paths": [
                    "<setting_1>",
                    "<setting_2>",
                    ...
                    "<setting_N>"
                ]
            }
            ```
            
            {% endcut %}
            
            {% endnote %}

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                -d '{
                      "cluster_id": "<cluster_ID>",
                      "update_mask": {
                        "paths": [
                          "config_spec.kafka.resources.resource_preset_id",
                          "config_spec.brokers_count"
                        ]
                      },
                      "config_spec": {
                        "kafka": {
                          "resources": {
                            "resource_preset_id": "<broker_host_class_ID>"
                          }
                        },
                        "brokers_count": {
                          "value": "<number_of_broker_hosts>"
                        }
                      }
                    }' \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ClusterService.Update
            ```

            Where:

            * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

                Specify the relevant parameters:
                * `config_spec.kafka.resources.resource_preset_id`: To change the broker host class.
                * `config_spec.brokers_count`: To change the number of broker hosts.

            You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}


## Changing a ZooKeeper host class {#change-zookeeper}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Select a new [**ZooKeeper host class**](../concepts/instance-types.md).
  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.

  To change the class of ZooKeeper hosts:

  1. Get information about the cluster:

     ```bash
     yc managed-kafka cluster list
     yc managed-kafka cluster get <cluster_name_or_ID>
     ```

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-kafka cluster update --help
     ```

  1. To change the ZooKeeper [host class](../concepts/instance-types.md), run this command:

     ```bash
     yc managed-kafka cluster update <cluster_name_or_ID> \
       --zookeeper-resource-preset <host_class>
     ```

  To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. In the Managed Service for Apache Kafka® cluster description, edit the `resource_preset_id` parameter value in the `zookeeper.resources` section to specify a new ZooKeeper [host class](../concepts/instance-types.md):

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          zookeeper {
            resources {
              resource_preset_id = "<ZooKeeper_host_class>"
              ...
            }
          }
         }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Get the list of available host classes:

        1. Call the [ResourcePreset.list](../api-ref/ResourcePreset/list.md) method, e.g., via the following [cURL](https://curl.se/) request:

            ```bash
            curl \
                --request GET \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/resourcePresets'
            ```

        1. Check the [server response](../api-ref/ResourcePreset/list.md#yandex.cloud.mdb.kafka.v1.ListResourcePresetsResponse) to make sure your request was successful.

    1. Change the host class as appropriate:

        1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
            
            {% endnote %}

            ```bash
            curl \
                --request PATCH \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --header "Content-Type: application/json" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
                --data '{
                          "updateMask": "configSpec.zookeeper.resources.resourcePresetId",
                          "configSpec": {
                            "zookeeper": {
                              "resources": {
                                "resourcePresetId": "<ZooKeeper_host_class_ID>"
                              }
                            }
                          }
                        }'
            ```

            Where:

            * `updateMask`: Comma-separated string of settings you want to update.

                Specify the relevant parameters:
                * `configSpec.zookeeper.resources.resourcePresetId`: To change the ZooKeeper host class.

            You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Get the list of available host classes:

        1. Call the [ResourcePresetService/List](../api-ref/grpc/ResourcePreset/list.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/resource_preset_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ResourcePresetService.List
            ```

        1. Check the [server response](../api-ref/grpc/ResourcePreset/list.md#yandex.cloud.mdb.kafka.v1.ListResourcePresetsResponse) to make sure your request was successful.

    1. Change the host class as appropriate:

        1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
            
            {% cut "Format for listing settings" %}
            
            ```yaml
            "update_mask": {
                "paths": [
                    "<setting_1>",
                    "<setting_2>",
                    ...
                    "<setting_N>"
                ]
            }
            ```
            
            {% endcut %}
            
            {% endnote %}

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                -d '{
                      "cluster_id": "<cluster_ID>",
                      "update_mask": {
                        "paths": [
                          "config_spec.zookeeper.resources.resource_preset_id"
                        ]
                      },
                      "config_spec": {
                        "zookeeper": {
                          "resources": {
                            "resource_preset_id": "<ZooKeeper_host_class_ID>"
                          }
                        }
                      }
                    }' \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ClusterService.Update
            ```

            Where:

            * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

                Specify the relevant parameters:
                * `config_spec.zookeeper.resources.resource_preset_id`: To change the ZooKeeper host class.

            You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}



## Changing a KRaft host class {#change-kraft}

{% note info %}

The KRaft host class is only used in clusters with Apache Kafka® 3.6 or higher.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Select a new [**KRaft host class**](../concepts/instance-types.md).
  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.

  To change the class of KRaft hosts:

  1. Get information about the cluster:

     ```bash
     yc managed-kafka cluster list
     yc managed-kafka cluster get <cluster_name_or_ID>
     ```

  1. View the description of the CLI command for updating a cluster:

     ```bash
     yc managed-kafka cluster update --help
     ```

  1. To change the KRaft [host class](../concepts/instance-types.md), run this command:

     ```bash
     yc managed-kafka cluster update <cluster_name_or_ID> \
       --controller-resource-preset <host_class>
     ```

  To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. In the Managed Service for Apache Kafka® cluster description, edit the `resource_preset_id` parameter value in the `kraft.resources` section to specify a new KRaft [host class](../concepts/instance-types.md):

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          kraft {
            resources {
              resource_preset_id = "<KRaft_host_class>"
              ...
            }
          }
         }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Get the list of available host classes:

        1. Call the [ResourcePreset.list](../api-ref/ResourcePreset/list.md) method, e.g., via the following [cURL](https://curl.se/) request:

            ```bash
            curl \
                --request GET \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/resourcePresets'
            ```

        1. Check the [server response](../api-ref/ResourcePreset/list.md#yandex.cloud.mdb.kafka.v1.ListResourcePresetsResponse) to make sure your request was successful.

    1. Change the host class as appropriate:

        1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
            
            {% endnote %}

            ```bash
            curl \
                --request PATCH \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --header "Content-Type: application/json" \
                --url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
                --data '{
                          "updateMask": "configSpec.kraft.resources.resourcePresetId",
                          "configSpec": {
                            "kraft": {
                              "resources": {
                                "resourcePresetId": "<KRaft_host_class_ID>"
                              }
                            }
                          }
                        }'
            ```

            Where:

            * `updateMask`: Comma-separated string of settings you want to update.

                Specify the relevant parameters:
                * `configSpec.kraft.resources.resourcePresetId`: To change the KRaft host class.

            You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Get the list of available host classes:

        1. Call the [ResourcePresetService/List](../api-ref/grpc/ResourcePreset/list.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/resource_preset_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ResourcePresetService.List
            ```

        1. Check the [server response](../api-ref/grpc/ResourcePreset/list.md#yandex.cloud.mdb.kafka.v1.ListResourcePresetsResponse) to make sure your request was successful.

    1. Change the host class as appropriate:

        1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

            {% note warning %}
            
            The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
            
            {% cut "Format for listing settings" %}
            
            ```yaml
            "update_mask": {
                "paths": [
                    "<setting_1>",
                    "<setting_2>",
                    ...
                    "<setting_N>"
                ]
            }
            ```
            
            {% endcut %}
            
            {% endnote %}

            ```bash
            grpcurl \
                -format json \
                -import-path ~/cloudapi/ \
                -import-path ~/cloudapi/third_party/googleapis/ \
                -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
                -rpc-header "Authorization: Bearer $IAM_TOKEN" \
                -d '{
                      "cluster_id": "<cluster_ID>",
                      "update_mask": {
                        "paths": [
                          "config_spec.kraft.resources.resource_preset_id"
                        ]
                      },
                      "config_spec": {
                        "kraft": {
                          "resources": {
                            "resource_preset_id": "<KRaft_host_class_ID>"
                          }
                        }
                      }
                    }' \
                mdb.api.cloud.yandex.net:443 \
                yandex.cloud.mdb.kafka.v1.ClusterService.Update
            ```

            Where:

            * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

                Specify the relevant parameters:
                * `config_spec.kraft.resources.resource_preset_id`: To change the KRaft host class.

            You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters). Earlier, you already obtained the list of available host classes with their IDs.

        1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}



## Changing security group and public access settings {#change-sg-set}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Under **Network settings**, select the security groups for cluster network traffic.
  1. Enable or disable **Public access** to your cluster.
  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.

  To change the list of [security groups](../concepts/network.md#security-groups) for your cluster:

  1. View the description of the CLI command for updating a cluster:

      ```bash
      yc managed-kafka cluster update --help
      ```

  1. Run this command, specifying the security groups and public access settings:

      ```bash
      yc managed-kafka cluster update <cluster_name_or_ID> \
         --security-group-ids <list_of_security_groups> \
         --assign-public-ip=<enable_public_access_to_cluster>
      ```

      Where:

      * `--security-group-ids`: List of cluster security group IDs.
      * `--assign-public-ip`: Public access to the cluster, `true` or `false`.

      To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. Change the values of the `security_group_ids` and `assign_public_ip` parameters in the cluster description:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          security_group_ids = [ <list_of_security_groups> ]
          ...
          config {
            assign_public_ip = "<enable_public_access_to_cluster>"
            ...
            }
        }
        ```

        Where:
        * `security_group_ids`: List of cluster security group IDs.
        * `assign_public_ip`: Public access to the cluster, `true` or `false`.

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            -url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "securityGroupIds,configSpec.assignPublicIp",
                      "securityGroupIds": [
                        <list_of_security_group_IDs>
                      ],
                      "configSpec": {
                        "assignPublicIp": "<enable_public_access_to_cluster>"
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

            Specify the relevant parameters:
            * `securityGroupIds`: To change the list of security groups.
            * `configSpec.assignPublicIp`: To change the public access setting.
        * `securityGroupIds`: [Security group](../../vpc/concepts/security-groups.md) IDs as an array of strings. Each string is a security group ID.

            {% note warning %}

            The list of security groups assigned to the cluster will be completely overwritten by the list provided in the `securityGroupIds` parameter.

            Before running your request, make sure the list includes all the required security group IDs, including existing ones.

            {% endnote %}

        * `assignPublicIp`: Access to broker hosts from the internet, `true` or `false`.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [
                      "security_group_ids",
                      "config_spec.assign_public_ip"
                    ]
                  },
                  "security_group_ids": [
                    <list_of_security_group_IDs>
                  ],
                  "config_spec": {
                    "assign_public_ip": "<enable_public_access_to_cluster>"
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.kafka.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Specify the relevant parameters:
            * `security_group_ids`: To change the list of security groups.
            * `config_spec.assign_public_ip`: To change the public access setting.
        * `security_group_ids`: [Security group](../../vpc/concepts/security-groups.md) IDs as an array of strings. Each string is a security group ID.

            {% note warning %}

            The list of security groups assigned to the cluster will be completely overwritten by the list provided in the `security_group_ids` parameter.

            Before running your request, make sure the list includes all the required security group IDs, including existing ones.

            {% endnote %}

        * `assign_public_ip`: Access to broker hosts from the internet, `true` or `false`.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

[Restart the cluster](cluster-stop.md) so the new public access settings take effect.

You may need to additionally [configure security groups](connect/index.md#configuring-security-groups) to connect to the cluster.


## Changing additional cluster settings {#change-additional-settings}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Change additional cluster settings:

     * **Maintenance**: [Maintenance window](../concepts/maintenance.md) settings:
     
         * To enable maintenance at any time, select **At any time** (default).
         * To specify the preferred maintenance start time, select **By schedule** and specify the day of the week and the UTC time interval. For example, you can choose a time when the cluster is least loaded.
         
         Both active and stopped clusters are subject to maintenance. Maintenance operations include DBMS updates, patches, etc.
     
     
     * **Deletion protection**: Manages cluster protection against accidental deletion.
     
         Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.
     
     
     * **Disk encryption**: Enable this setting to encrypt the disks with a [custom KMS key](../../kms/concepts/key.md).
     
        * To [create](../../kms/operations/key.md#create) a new key, click **Create**.
     
        * To use a previously created key, select it in the **KMS key** field.
     
        To learn more about disk encryption, see [Storage](../concepts/storage.md#disk-encryption).
     
        {% note warning %}
        
        You can enable disk encryption only when creating a cluster.
        
        {% endnote %}
     
     
     * **Schema registry**: Enable this setting to manage data schemas using [Managed Schema Registry](../concepts/managed-schema-registry.md).
     
         {% note warning %}
         
         You cannot disable data schema management using Managed Schema Registry after enabling it.
         
         {% endnote %}
     
     * **Kafka Rest API**: Enable this setting to allow sending requests to the Apache Kafka® API.
     
         It is implemented using [Karapace](https://github.com/Aiven-Open/karapace), an open-source tool. The Karapace API is compatible with the [Confluent REST Proxy API](https://docs.confluent.io/platform/current/kafka-rest/api.html) with only minor exceptions.
     
         {% note warning %}
     
         You cannot disable **Kafka Rest API** once it is enabled.
     
         {% endnote %}
     
     
     * **Kafka UI**: Enable this setting to use the [Apache Kafka®](../concepts/kafka-ui.md) web UI.

  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.

    To change advanced cluster settings:

    1. View the description of the CLI command for updating a cluster:

        ```bash
        yc managed-kafka cluster update --help
        ```

    1. Run the following command with the list of settings you want to update:

        
        ```bash
        yc managed-kafka cluster update <cluster_name_or_ID> \
           --maintenance-window type=<maintenance_type>,`
                               `day=<day_of_week>,`
                               `hour=<hour> \
           --datatransfer-access=<allow_access_from_Data_Transfer> \
           --deletion-protection \
           --schema-registry=<data_schema_management>
        ```


    You can update the following settings:

    * `--maintenance-window`: [Maintenance window](../concepts/maintenance.md) settings (including for stopped clusters), where `type` is the maintenance type:

        * `anytime`: Any time (default).
        * `weekly`: On a schedule. For this value, also specify the following:
            * `day`: Day of week, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
            * `hour`: Sequence number of UTC hour interval, from `1` to `24`.
        
              > For example, `1` stands for the interval from `00:00` to `01:00`, and `5`, from `04:00` to `05:00`.


    * `--deletion-protection`: Cluster protection from accidental deletion, `true` or `false`.

        Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.

    * `--schema-registry`: Manage data schemas using [Managed Schema Registry](../concepts/managed-schema-registry.md), `true` or `false`.

        {% note warning %}
        
        You cannot disable data schema management using Managed Schema Registry after enabling it.
        
        {% endnote %}

    To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. To set up the [maintenance window](../concepts/maintenance.md) that will also apply to stopped clusters, add the `maintenance_window` section to the cluster description:
       
       ```hcl
       resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
         ...
         maintenance_window {
           type = "<maintenance_type>"
           day  = "<day_of_week>"
           hour = <hour>
         }
         ...
       }
       ```
       
       Where:
       
       * `type`: Maintenance type. The possible values include:
           * `ANYTIME`: Any time.
           * `WEEKLY`: On a schedule.
       * `day`: Day of week for the `WEEKLY` type, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
       * `hour`: Sequence number of UTC hour interval for the `WEEKLY` type, from `1` to `24`.
       
         > For example, `1` stands for the interval from `00:00` to `01:00`, and `5`, from `04:00` to `05:00`.

    1. To activate cluster protection against accidental deletion by a user of your cloud, add the `deletion_protection` field set to `true` to the cluster description:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          deletion_protection = <protect_cluster_from_deletion>
        }
        ```

        Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.

    1. To enable data schema management using [Managed Schema Registry](../concepts/managed-schema-registry.md), add the `config.schema_registry` field set to `true` to the cluster description:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          config {
            ...
            schema_registry  = <data_schema_management>
          }
        }
        ```

        {% note warning %}
        
        You cannot disable data schema management using Managed Schema Registry after enabling it.
        
        {% endnote %}

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        
        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            -url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "configSpec.restApiConfig.enabled,configSpec.schemaRegistry,maintenanceWindow,deletionProtection",
                      "configSpec": {
                        "schemaRegistry": true,
                        "restApiConfig": {
                          "enabled": true
                        }
                      },
                      "maintenanceWindow": {
                        "anytime": {},
                        "weeklyMaintenanceWindow": {
                          "day": "<day_of_week>",
                          "hour": "<hour_UTC>"
                        }
                      },
                      "deletionProtection": <protect_cluster_from_deletion>
                    }'
        ```


        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

            Specify the relevant parameters:
            * `configSpec.schemaRegistry`: To enable the settings for data schema management using [Managed Schema Registry](../concepts/managed-schema-registry.md).
            * `configSpec.restApiConfig.enabled`: To enable sending Apache Kafka® REST API requests.


            * `maintenanceWindow`: To change the [maintenance window](../concepts/maintenance.md) settings, including for stopped clusters.
            * `deletionProtection`: To enable or disable cluster protection from accidental deletion.

              Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.

        * `configSpec.schemaRegistry`: Set to `true` to manage data schemas using [Managed Schema Registry](../concepts/managed-schema-registry.md). You will not be able to edit this setting once it is enabled.
        * `configSpec.restApiConfig.enabled`: Set to `true` to enable sending Apache Kafka® REST API requests. You will not be able to edit this setting once it is enabled.


        * `maintenanceWindow`: [Maintenance window](../concepts/maintenance.md) settings, applying to both running and stopped clusters. Select one of these options:

            * `anytime`: At any time (default).
            * `weeklyMaintenanceWindow`: On schedule:
                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC) in `HH` format, from `1` to `24`.

        * `deletionProtection`: To enable (`true`) or disable (`false`) cluster protection from accidental deletion.

            Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        
        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [
                      "maintenance_window",
                      "deletion_protection",
                      "config_spec.schema_registry",
                      "config_spec.rest_api_config.enabled"
                    ]
                  },
                  "config_spec": {
                    "schema_registry": true,
                    "rest_api_config": {
                      "enabled": true
                    }
                  },
                  "maintenance_window": {
                    "anytime": {},
                    "weekly_maintenance_window": {
                      "day": "<day_of_week>",
                      "hour": "<hour_UTC>"
                    }
                  },
                  "deletion_protection": <protect_cluster_from_deletion>
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.kafka.v1.ClusterService.Update
        ```


        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Specify the relevant parameters:
            * `config_spec.schema_registry`: To manage data schemas using [Managed Schema Registry](../concepts/managed-schema-registry.md).
            * `config_spec.rest_api_config.enabled`: To enable sending Apache Kafka® REST API requests.


            * `maintenance_window`: To change the [maintenance window](../concepts/maintenance.md) settings, including for stopped clusters.
            * `deletion_protection`: To enable or disable protection of the cluster, its databases, and users from accidental deletion.
        * `schema_registry`: Set to `true` to manage data schemas using [Managed Schema Registry](../concepts/managed-schema-registry.md). You will not be able to edit this setting once it is enabled.
        * `rest_api_config.enabled`: Set to `true` to enable sending Apache Kafka® REST API requests. You will not be able to edit this setting once it is enabled.


        * `maintenance_window`: [Maintenance](../concepts/maintenance.md) window settings. Select one of these options:

            * `anytime`: Any time.
            * `weekly_maintenance_window`: On schedule:
                * `day`: Day of week in `DDD` format, i.e., `MON`, `TUE`, `WED`, `THU`, `FRI`, `SAT`, or `SUN`.
                * `hour`: Time of day (UTC) in `HH` format, from `1` to `24`.

        * `deletion_protection`: To enable (`true`) or disable (`false`) cluster protection from accidental deletion.

            Even with cluster deletion protection enabled, one can still delete a user or topic or connect manually and delete the data.

        You can get the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Changing Apache Kafka® settings {#change-kafka-settings}

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
  1. Navigate to **Managed Service for&nbsp;Kafka**.
  1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
  1. Under **Kafka Settings**, click **Settings**.

     For more information, see [Apache Kafka® settings](../concepts/settings-list.md).

  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.

    To update the Apache Kafka® settings:

    1. See the description of the CLI command for updating cluster settings:

        ```bash
        yc managed-kafka cluster update --help
        ```

    1. Run the cluster update command, providing the [Apache Kafka® settings](../concepts/settings-list.md#cluster-settings) you want to change (the example below does not list all possible parameters):

        ```bash
        yc managed-kafka cluster update <cluster_name_or_ID> \
           --compression-type <compression_type> \
           --log-flush-interval-messages <number_of_messages_in_log> \
           --log-flush-interval-ms <maximum_time_to_store_messages>
        ```

        Where:

        * `--log-flush-interval-messages`: Number of messages in the log to trigger flushing to disk.
        * `--log-flush-interval-ms`: Maximum time a message can be stored in memory before flushing to disk.

        To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. In the Managed Service for Apache Kafka® cluster description, edit the values of the parameters in the `kafka.kafka_config` section (the example below does not list all possible [settings](../concepts/settings-list.md#cluster-settings)):

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          config {
            kafka {
              ...
              kafka_config {
                compression_type            = "<compression_type>"
                log_flush_interval_messages = <maximum_number_of_messages_in_memory>
                ...
              }
            }
          }
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.update](../api-ref/Cluster/update.md) method, e.g., via the following [cURL](https://curl.se/) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `updateMask` parameter as a single comma-separated string.
        
        {% endnote %}

        ```bash
        curl \
            --request PATCH \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            -url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>' \
            --data '{
                      "updateMask": "configSpec.kafka.kafkaConfig_2_8.<setting_1_for_Apache Kafka®_2.8_configuration>,...,configSpec.kafka.kafkaConfig_2_8.<setting_N_for_Apache Kafka®_2.8_configuration>,configSpec.kafka.kafkaConfig_3.<setting_1_for_Apache Kafka®_3.x_configuration>,...,configSpec.kafka.kafkaConfig_3.<setting_N_for_Apache Kafka®_3.x_configuration>",
                      "configSpec": {
                        "kafka": {
                          "kafkaConfig_2_8": {
                            "<setting_1_for_Apache Kafka®_2.8_configuration>": "<setting_value>",
                            "<setting_2_for_Apache Kafka®_2.8_configuration>": "<setting_value>",
                            ...,
                            "<setting_N_for_Apache Kafka®_2.8_configuration>": "<setting_value>"
                          },
                          "kafkaConfig_3": {
                            "<setting_1_for_Apache Kafka®_3.x_configuration>": "<setting_value>",
                            "<setting_2_for_Apache Kafka®_3.x_configuration>": "<setting_value>",
                            ...,
                            "<setting_N_for_Apache Kafka®_3.x_configuration>": "<setting_value>"
                          }
                        }
                      }
                    }'
        ```

        Where:

        * `updateMask`: Comma-separated string of settings you want to update.

            Specify the relevant parameters:
            * `configSpec.kafka.kafkaConfig_2_8.<setting_for_Apache Kafka®_2.8_configuration>`: For Apache Kafka® `2.8`.
            * `configSpec.kafka.kafkaConfig_3.<setting_for_Apache Kafka®_3.x_configuration>`: For Apache Kafka® `3.x`.
        * `configSpec.kafka.kafkaConfig_2_8.<setting_for_Apache Kafka®_2.8_configuration`: Specify a new value for the setting if using Apache Kafka® `2.8`.
        * `configSpec.kafka.kafkaConfig_3.<setting_for_Apache Kafka®_3.x_configuration`: Specify a new value for the setting if using Apache Kafka® `3.x`.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService/Update](../api-ref/grpc/Cluster/update.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        {% note warning %}
        
        The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the `update_mask` parameter as an array of `paths[]` strings.
        
        {% cut "Format for listing settings" %}
        
        ```yaml
        "update_mask": {
            "paths": [
                "<setting_1>",
                "<setting_2>",
                ...
                "<setting_N>"
            ]
        }
        ```
        
        {% endcut %}
        
        {% endnote %}

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "update_mask": {
                    "paths": [
                      "config_spec.kafka.kafka_config_2_8.<setting_1_for_Apache Kafka®_2.8_configuration>",
                      ...,
                      "config_spec.kafka.kafka_config_2_8.<setting_N_for_Apache Kafka®_2.8_configuration>",
                      "config_spec.kafka.kafka_config_3.<setting_1_for_Apache Kafka®_3.x_configuration>",
                      ...,
                      "config_spec.kafka.kafka_config_3.<setting_N_for_Apache Kafka®_3.x_configuration>"
                    ]
                  }
                  "config_spec": {
                    "kafka": {
                      "kafka_config_2_8": {
                        "<setting_1_for_Apache Kafka®_2.8_configuration>": "<setting_value>",
                        "<setting_2_for_Apache Kafka®_2.8_configuration>": "<setting_value>",
                        ...,
                        "<setting_N_for_Apache Kafka®_2.8_configuration>": "<setting_value>"
                      },
                      "kafka_config_3": {
                        "<setting_1_for_Apache Kafka®_3.x_configuration>": "<setting_value>",
                        "<setting_2_for_Apache Kafka®_3.x_configuration>": "<setting_value>",
                        ...,
                        "<setting_N_for_Apache Kafka®_3.x_configuration>": "<setting_value>"
                      }
                    }
                  }
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.kafka.v1.ClusterService.Update
        ```

        Where:

        * `update_mask`: List of settings you want to update as an array of strings (`paths[]`).

            Specify the relevant parameters:
            * `config_spec.kafka.kafka_config_2_8.<setting_for_Apache Kafka®_2.8_configuration>`: For Apache Kafka® `2.8`.
            * `config_spec.kafka.kafka_config_3.<setting_for_Apache Kafka®_3.x_configuration>`: For Apache Kafka® `3.x`.
        * `config_spec.kafka.kafka_config_2_8.<setting_for_Apache Kafka®_2.8_configuration`: Specify a new value for the setting if using Apache Kafka® `2.8`.
        * `config_spec.kafka.kafka_config_3.<setting_for_Apache Kafka®_3.x_configuration`: Specify a new value for the setting if using Apache Kafka® `3.x`.

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}

## Moving a cluster to another folder {#move-cluster}

{% list tabs group=instructions %}


- 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.

    To move a cluster:

    1. View the description of the CLI command for moving a cluster:

        ```bash
        yc managed-kafka cluster move --help
        ```

    1. Specify the destination folder in the cluster move command:

        ```bash
        yc managed-kafka cluster move <cluster_name_or_ID> \
           --destination-folder-name=<destination_folder_name>
        ```

        To find out the cluster name or ID, [get the list of clusters in the folder](cluster-list.md#list-clusters).

- Terraform {#tf}

    1. Open the current Terraform configuration file describing your infrastructure.

        For information about creating this file, see [Creating a cluster Apache Kafka®](cluster-create.md).

    1. In the Managed Service for Apache Kafka® cluster description, add or update the `folder_id` argument:

        ```hcl
        resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
          ...
          folder_id = "<destination_folder_ID>"
        }
        ```

    1. Make sure the settings are correct.

        1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
        1. Run this command:
        
           ```bash
           terraform validate
           ```
        
           Terraform will show any errors found in your configuration files.

    1. Confirm resource changes.

        1. Run this command to view the planned changes:
        
           ```bash
           terraform plan
           ```
        
           If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
        
        1. If everything looks correct, apply the changes:
           1. Run this command:
        
              ```bash
              terraform apply
              ```
        
           1. Confirm updating the resources.
           1. Wait for the operation to complete.

    For more information, see [this Terraform provider guide](../../terraform/resources/mdb_kafka_cluster.md).

    {% note warning "Timeouts" %}
    
    The Terraform provider limits the time for all operations with the Managed Service for Apache Kafka® cluster to 60 minutes.
    
    Operations exceeding the timeout are aborted.
    
    {% cut "How do I change these limits?" %}
    
    Add the `timeouts` section to your cluster description, such as the following:
    
    ```hcl
    resource "yandex_mdb_kafka_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    ```
    
    {% endcut %}
    
    {% endnote %}

- REST API {#api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Call the [Cluster.move](../api-ref/Cluster/move.md) method, e.g., via the following [cURL](https://curl.se/) request:

        ```bash
        curl \
            --request POST \
            --header "Authorization: Bearer $IAM_TOKEN" \
            --header "Content-Type: application/json" \
            -url 'https://mdb.api.cloud.yandex.net/managed-kafka/v1/clusters/<cluster_ID>:move' \
            --data '{
                      "destinationFolderId": "<folder_ID>"
                    }'
        ```

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. View the [server response](../api-ref/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

- gRPC API {#grpc-api}

    1. [Get an IAM token for API authentication](../api-ref/authentication.md) and put it into an environment variable:

        ```bash
        export IAM_TOKEN="<IAM_token>"
        ```

    1. Clone the [cloudapi](https://github.com/yandex-cloud/cloudapi) repository:
       
       ```bash
       cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
       ```
       
       Below, we assume that the repository contents reside in the `~/cloudapi/` directory.

    1. Call the [ClusterService/Move](../api-ref/grpc/Cluster/move.md) method, e.g., via the following [gRPCurl](https://github.com/fullstorydev/grpcurl) request:

        ```bash
        grpcurl \
            -format json \
            -import-path ~/cloudapi/ \
            -import-path ~/cloudapi/third_party/googleapis/ \
            -proto ~/cloudapi/yandex/cloud/mdb/kafka/v1/cluster_service.proto \
            -rpc-header "Authorization: Bearer $IAM_TOKEN" \
            -d '{
                  "cluster_id": "<cluster_ID>",
                  "destination_folder_id": "<folder_ID>"
                }' \
            mdb.api.cloud.yandex.net:443 \
            yandex.cloud.mdb.kafka.v1.ClusterService.Move
        ```

        You can request the cluster ID with the [list of clusters in the folder](cluster-list.md#list-clusters).

    1. Check the [server response](../api-ref/grpc/Cluster/update.md#yandex.cloud.operation.Operation) to make sure your request was successful.

{% endlist %}