# Upgrading Datafy

{% hint style="info" %}
The following is relevant when installing version `1.28.0` or higher. If installing an older version, you must [uninstall](/set-up-and-installation/uninstalling-datafy.md) the existing agent before installing the newer version.
{% endhint %}

## Upgrading From Sensor to AutoScaler

Datafy **Sensor** and **AutoScaler** are both based on shared components, operating at different permission levels: Sensor is read-only, and AutoScaler can modify and create volumes.

If you already have Sensor installed and want to upgrade to AutoScaler, these permissions need to be updated, and additional components that manage the volume lifecycle need to be installed.

{% stepper %}
{% step %}
**Update IAM Role**

Update the IAM role you created when installing Datafy Sensor, using the AutoScaler permissions level in the [role template](/set-up-and-installation/datafy-installation/permissions-configuration.md).

{% hint style="info" %}
If you choose to create a new role and not update the existing one, make sure to update the role ARN in your Datafy dashboard
{% endhint %}
{% endstep %}

{% step %}
**Install Datafy AutoScaler**

[Install Datafy AutoScaler](/set-up-and-installation/datafy-installation/installation.md) the same way you installed Sensor, using the AutoScaler version of the installation command.

{% hint style="info" %}
We recommend asking about the latest version before you upgrade
{% endhint %}
{% endstep %}
{% endstepper %}

## Upgrading Version of Existing Agent

### Sensor

You can upgrade the version of Datafy Sensor you have installed by running the [install command](/set-up-and-installation/datafy-installation/installation.md) with the new version you'd like to install.

Before upgrading, you can check which version is already installed with the following:

{% tabs %}
{% tab title="EC2" %}
You can check which version is installed on your instance with the command:

```bash
 /usr/local/datafy-agent/bin/datafy-agent --version
```

{% endtab %}

{% tab title="K8s" %}
You can check which version is installed on your cluster by checking the image tag of the `datafy-installer` DaemonSet, or use the command:

{% code overflow="wrap" %}

```
kubectl exec -it -n kube-system datafy-installer-<pod-id> -- /usr/local/datafy-agent/bin/datafy-agent --version
```

{% endcode %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
You can install a newer or older version this way, make sure to check which is the right one
{% endhint %}

### AutoScaler

#### Upgrading From Version `1.32.0` or Above

AutoScaler is upgraded in the same way as Sensor. Volumes with active autoscaling and the data on them will continue to be available during the upgrade, with a short period of increased latency.

If the new version includes a kernel module upgrade, it will be implemented the next time the instance reboots. If the Autoscale upgrade is performed during a scheduled maintenance window, it is recommended to reboot the instance following the upgrade to ensure the kernel is updated.

#### Upgrading From Version < `1.32.0`

AutoScaler is upgraded in the same way as Sensor. However, if you have volumes with active autoscaling, they may become temporarily unavailable during the upgrade.

In this case, after running the install command, you will be warned and prompted to approve the installation. If there is no response, the installation will be aborted.

{% code overflow="wrap" %}

```
Autoscaling volumes may be unavailable during installation. Do you want to proceed? [y/N]: y
```

{% endcode %}

You can use the flag `FORCE_INSTALL=true` to skip the prompt and approve the installation in advance. For example:

{% code overflow="wrap" %}

```bash
curl -sSfL https://agent.datafy.io/install?version=$VERSION | AGENT_MODE="autoscaler" TOKEN=$TOKEN FORCE_INSTALL=true sh
```

{% endcode %}

{% hint style="warning" %}
To ensure no impact on your application or the data on the autoscaling volumes, we recommend unmounting them before upgrading AutoScaler.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datafy.io/set-up-and-installation/upgrading-datafy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
