[Yandex Cloud documentation](../../index.md) > [Yandex Managed Service for Apache Airflow™](../index.md) > [Step-by-step guides](index.md) > Clusters > Updating Apache Airflow™ and Python versions

# Updating Apache Airflow™ and Python versions

You can find the list of supported versions in the [Versioning](../concepts/versions.md) section.

When updating versions in Managed Service for Apache Airflow™, you can change the following:

* Python version to any supported one for the current Apache Airflow™ version.
* Apache Airflow™ version to the next supported version within the same branch: `2.X` or `3.X`.

    You cannot update Apache Airflow™ from `2.X` to `3.X`. To update to `3.X`, [create a new cluster](cluster-create.md) and attach the old cluster's DAG storage to it.

Managed Service for Apache Airflow™ does not allow simultaneous updates of Apache Airflow™ and Python versions because user dependencies may stop working on newer Python versions.

For example, to update a cluster from Apache Airflow™ `2.8` and Python `3.8` to Apache Airflow™ `2.10` and Python `3.12`:

1. Update Python to `3.10` and test the cluster with its dependencies.
1. Update Apache Airflow™ to `2.10` and test the cluster after you migrate the database.
1. Update Python to `3.12` and test the dependencies again.

To learn about upgrades within the same version and host maintenance, see [Maintenance](../concepts/maintenance.md).

{% note alert %}

Before the upgrade, make sure it will not affect your applications: review the [release notes for Apache Airflow™](https://airflow.apache.org/docs/apache-airflow/stable/release_notes.html) and [Python](https://www.python.org/downloads/).

Once your Apache Airflow™ version is upgraded, you cannot revert the cluster to the previous version.

{% endnote %}

{% list tabs group=instructions %}

- Management console {#console}

    To upgrade your Apache Airflow™ or Python version:

    1. In the [management console](https://console.yandex.cloud), navigate to the relevant folder.
    1. Navigate to **Managed Service for&nbsp;Apache&nbsp;Airflow™**.
    1. In the cluster row, click ![image](../../_assets/console-icons/ellipsis.svg) and select **Edit**.
    1. In the **Version** field, select the Apache Airflow™ and Python version you need.
    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 upgrade your Apache Airflow™ or Python version:

    1. Get the list of your Managed Service for Apache Airflow™ clusters:

        ```bash
        yc managed-airflow cluster list
        ```

    1. Get information about the cluster you need and check the version in the `config.airflow_version` and `config.python_version` properties:

        ```bash
        yc managed-airflow cluster get <cluster_name_or_ID>
        ```

    1. To upgrade your Apache Airflow™ version, run this command:

        ```bash
        yc managed-airflow cluster update <cluster_name_or_ID> \
          --airflow-version=<new_version_number>
        ```

    1. To upgrade a Python version, run this command:

        ```bash
        yc managed-airflow cluster update <cluster_name_or_ID> \
          --python-version=<new_version_number>
        ```

- Terraform {#tf}

    To upgrade your Apache Airflow™ or Python version:

    1. Open the current Terraform configuration file with the infrastructure plan.

        Learn how to create the file in [Creating a cluster](cluster-create.md).

    1. Add the `airflow_version` or `python_version` parameter to the cluster description or update it if it is already there:

        ```hcl
        resource "yandex_airflow_cluster" "<cluster_name>" {
          ...
          airflow_version = "<Apache_Airflow™_version>"
          python_version  = "<Python_version>"
        }
        ```

    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 updating the resources.

        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/airflow_cluster.md).

- REST API {#api}

    To upgrade your Apache Airflow™ or Python version:

    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 and run the request, e.g., via [cURL](https://curl.se/).

        {% 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 %}

        * To upgrade your Apache Airflow™ version, run this request:

            ```bash
            curl \
                --request PATCH \
                --header "Authorization: Bearer $IAM_TOKEN" \
                --header "Content-Type: application/json" \
                --url 'https://airflow.api.cloud.yandex.net/managed-airflow/v1/clusters/<cluster_ID>' \
                --data '{
                          "updateMask": "airflowVersion",
                          "airflowVersion": "<Apache_Airflow™_version>"
                        }'
            ```

           Where:

            * `updateMask`: List of parameters to update. Specify only `airflowVersion`.

            * `airflowVersion`: Target Apache Airflow™ version.

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

        * To upgrade your Python version, run this request:

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

            Where:

            * `updateMask`: List of parameters to update. Specify only `pythonVersion`.

            * `pythonVersion`: Target Python version.

            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}

    To upgrade your Apache Airflow™ or Python version:

    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 %}

        * To upgrade your Apache Airflow™ version, run this request:

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

            Where:

            * `update_mask`: List of parameters to update. Specify only `airflow_version`.

            * `airflow_version`: Target Apache Airflow™ version.

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

        * To upgrade your Python version, run this request:

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

            Where:

            * `update_mask`: List of parameters to update. Specify only `python_version`.

            * `python_version`: Target Python version.

            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 %}

## Examples {#examples}

Let's assume you need to upgrade Apache Airflow™ from `2.10` to `2.11`, and Python from `3.10` to `3.12`.

{% list tabs group=instructions %}

- CLI {#cli}

    1. To get a list of clusters with their IDs and names, run this command:

        ```bash
        yc managed-airflow cluster list
        ```

        ```text
        +----------------------+------------+---------------------+--------+---------+
        |          ID          |    NAME    |     CREATED AT      | HEALTH | STATUS  |
        +----------------------+------------+---------------------+--------+---------+
        | c9qqhh2u3r20******** | airflow411 | 2026-02-26 15:39:33 | ALIVE  | RUNNING |
        +----------------------+------------+---------------------+--------+---------+
        ```

    1. To get information about the `airflow411` cluster, run the following command:

        ```bash
        yc managed-airflow cluster get airflow411
        ```

        Result:

        ```text
        id: c9qqhh2u3r20********
        ...
        config:
          ...
          airflow-version: "2.10"
          python-version: "3.10"
        ```

    1. To update Apache Airflow™ to version `2.11`, run this command:

        ```bash
        yc managed-airflow cluster update airflow411 \
          --airflow-version=2.11
        ```

        Wait for the operation to complete.

    1. To update Python to version `3.12`, run this command:

        ```bash
        yc managed-airflow cluster update airflow411 \
          --python-version=3.12
        ```

- Terraform {#tf}

    1. Open the current Terraform configuration file with the infrastructure plan.
    1. In the cluster description, set the `airflow_version` field value to `2.11`.

        ```hcl
        resource "yandex_airflow_cluster" "<cluster_name>" {
          ...
          airflow_version = "2.11"
          ...
        }
        ```

    1. Apply the changes:

        ```bash
        terraform apply
        ```

    1. Set the `python_version` field value to `3.12`:

        ```hcl
        resource "yandex_airflow_cluster" "<cluster_name>" {
          ...
          python_version = "3.12"
          ...
        }
        ```

    1. Apply the changes once again:

        ```bash
        terraform apply
        ```

{% endlist %}

#### Useful links {#see-also}

* [Versioning in Managed Service for Apache Airflow™](../concepts/versions.md)
* [Apache Airflow™ versioning policy](../concepts/update-policy.md)