> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started with Managed Service for MLflow: create your first cluster

MLflow helps to track and manage your machine learning experiments. With clusters for MLflow in Nebius AI Cloud, you can deploy MLflow in a cloud in just a couple of clicks and connect to it easily from machines that run your workloads.

This guide covers how to set up your environment to work with Managed Service for MLflow, create your first *cluster*, run a simple experiment and access its artifacts in an Object Storage.

## Prepare your environment

Meet the following prerequisites, depending on the preferred interface:

<Tabs group="interfaces">
  <Tab title="Web console">
    1. Install the **MLflow** Python package that provides an API to run and manage experiments in your code:

       ```bash theme={null}
       pip install mlflow
       ```

    2. Make sure you are in a [group](/iam/authorization/groups/index) that has the `admin` role within your tenant; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
  </Tab>

  <Tab title="CLI">
    1. Install the following tools:

       * **MLflow**: Python package that provides an API to run and manage experiments in your code.
       * **jq**: ([How to install jq](https://jqlang.github.io/jq/download/)) and use it to parse JSON outputs from the Nebius AI Cloud CLI, and extract resource IDs for other commands.
       * **Nebius AI Cloud CLI**: ([How to install the CLI](../cli/install)), to manage all Nebius AI Cloud resources.

       Here are all the installation commands in a single copy-and-paste block:

           <CodeGroup>
             ```bash Ubuntu theme={null}
             pip install mlflow
             sudo apt-get install unzip jq
             curl -sSL https://storage.eu-north1.nebius.cloud/cli/install.sh | bash
             nebius profile create
             ```

             ```bash macOS theme={null}
             pip install mlflow
             brew install jq
             curl -sSL https://storage.eu-north1.nebius.cloud/cli/install.sh | bash
             nebius profile create
             ```
           </CodeGroup>

       The last command, `nebius profile create`, will guide you through several prompts. After you complete the prompts, your browser will open the Nebius AI Cloud web console sign-in screen. Sign in to the web console to complete the initialization. If you have access to multiple tenants, the CLI will prompt you to choose a tenant ID. After that, save your project ID in the CLI configuration:

       If the project ID has not been configured during the `nebius profile create` flow, [get the project ID](/iam/manage-projects#how-to-get-a-project-id) and save it in the CLI configuration:

       ```bash theme={null}
       nebius config set parent-id <project_ID>
       ```

    2. Make sure that you, or the service account that you use on your behalf, is in a [group](/iam/authorization/groups) that has the `admin` role within your tenant; for example, the default `admins` group. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
  </Tab>
</Tabs>

## Create a cluster

<Tabs group="interfaces">
  <Tab title="Web console">
    1. In the sidebar, go to <Icon icon="https://mintcdn.com/nebius-ai-cloud/1Ha0sWR6e1mnIaHS/_assets/sidebar/ai-services.svg?fit=max&auto=format&n=1Ha0sWR6e1mnIaHS&q=85&s=ab4ff229f7690c99deb1dc52d3daf987" width="16" height="16" data-path="_assets/sidebar/ai-services.svg" /> **ML tools** → **MLflow**.

    2. Click **Create cluster**.

    3. On the cluster creation page that opens, set the following parameters:

       * **Name**: Enter a name for your cluster.

       * **Service account**: Select the `mlflow-sa` service account. It was created for Managed MLflow by default after you [signed up](../signup-billing/sign-up) for Nebius AI Cloud.

       * **Access**: Select the **Public and private** option.

         In this case, the cluster has both public and private tracking endpoints. You can access the public endpoint from the internet and the private endpoint from the network where the cluster is located (for example, via a virtual machine in this network).

       * **Cluster size**: Select **Medium**.

       * **Admin credentials**: Enter a username and a strong password.

    4. Click **Create cluster**.
  </Tab>

  <Tab title="CLI">
    1. Create a password for administrator access to the cluster and save it to an environment variable:

       ```bash theme={null}
       export PASSWORD=<password>
       ```

       The password must be between 8 and 64 characters long and must contain at least the following:

       * One uppercase letter
       * One lowercase letter
       * One digit
       * One special character from \*\*-!@#\$^&\*\_=+:;'"\\|/?,.\~\§\±()\[]\{}\<>\\\`\*\*.

    2. Get the ID of the `mlflow-sa` service account. It was created by default after you [signed up](/signup-billing/sign-up) for Nebius AI Cloud. Save the ID to an environment variable:

       Get the ID of the `mlflow-sa` service account. It was created by default after you [signed up](/signup-billing/sign-up) for Nebius AI Cloud. Save the ID to an environment variable:

       ```bash theme={null}
       export SA_ID=$(nebius iam service-account get-by-name \
         --name mlflow-sa \
         --format json | jq -r '.metadata.id')
       ```

    3. Get the ID of the default network and save it to an environment variable:
       ```bash theme={null}
       export NETWORK_ID=$(nebius vpc network get-by-name \
         --name default-network \
         --format json | jq -r '.metadata.id')
       ```

    4. Create a test cluster:

       ```bash theme={null}
       nebius msp mlflow v1alpha1 cluster create \
         --name mlflow-test-cluster \
         --service-account-id $SA_ID \
         --network-id $NETWORK_ID \
         --admin-username admin \
         --admin-password $PASSWORD \
         --public-access=true
       ```
  </Tab>
</Tabs>

Together with the cluster, Managed Service for MLflow creates a bucket in Object Storage to store the experiment logs and metrics. This bucket is not deleted automatically after you delete the cluster. You are still charged for the bucket until you [delete](../object-storage/buckets/manage#how-to-delete-buckets) it.

## Configure connection to MLflow Tracking

1. Get the cluster tracking endpoint and save it to an environment variable:

   <Tabs group="interfaces">
     <Tab title="Web console">
       Go to the cluster page and copy the **Public Tracking URI** value. Append `https://` and save the resulting URL to an environment variable:

       ```bash theme={null}
       nebius msp mlflow v1alpha1 cluster create \
         --name mlflow-test-cluster \
         --service-account-id $SA_ID \
         --network-id $NETWORK_ID \
         --admin-username admin \
         --admin-password $PASSWORD \
         --public-access=true
       ```
     </Tab>

     <Tab title="CLI">
       Run the following command:

       ```bash theme={null}
       export MLFLOW_TRACKING_URI=https://$(nebius msp mlflow v1alpha1 cluster get-by-name \
         --name mlflow-test-cluster \
         --format json | jq -r ".status.tracking_endpoint")
       ```
     </Tab>
   </Tabs>

2. Set up other [environment variables](https://mlflow.org/docs/latest/python_api/mlflow.environment_variables.html) used by MLflow Tracking:

   ```bash theme={null}
   export MLFLOW_TRACKING_USERNAME=<admin_username>
   export MLFLOW_TRACKING_PASSWORD=<admin_password>
   export MLFLOW_EXPERIMENT_NAME=<default_experiment_name>
   ```

For more details on secure connection to the tracking server, see [MLflow documentation](https://mlflow.org/docs/latest/tracking/server.html#secure-tracking-server).

## Run an experiment and check its results

1. Run an experiment:

   1. Create a Python script, `nebius_mlflow_test.py`, that trains a linear regression model on a simple, randomly populated dataset and uses MLflow autologging to log the training:

      ```python theme={null}
      import mlflow
      import numpy as np
      from sklearn.model_selection import train_test_split
      from sklearn.linear_model import LinearRegression

      np.random.seed(42)
      X = np.random.rand(100, 1)
      y = 3.5 * X.squeeze() + np.random.randn(100) * 0.5
      X_train, X_test, y_train, y_test = train_test_split(
          X, y, test_size=0.2, random_state=42)

      mlflow.autolog()

      model = LinearRegression()
      model.fit(X_train, y_train)
      ```

   2. Run the script:

      ```bash theme={null}
      python3 nebius_mlflow_test.py
      ```

2. Check the experiment artifacts:

   <Tabs group="interfaces">
     <Tab title="Web console">
       Go to the cluster page and click **Go to web UI**. Enter the admin credentials you specified when creating the cluster.

       In the left pane, you can see a list of experiments. Select the experiment you just ran and review its results.
     </Tab>

     <Tab title="CLI">
       Get the public tracking endpoint URL of the cluster:

       ```bash theme={null}
       nebius msp mlflow v1alpha1 cluster get-by-name \
         --name mlflow-test-cluster \
         --format json | jq -r ".status.tracking_endpoint"
       ```

       Open the URL in your browser and enter the admin credentials you specified when creating the cluster.

       In the left pane, you can see a list of experiments. Select the experiment you just ran and review its results.
     </Tab>
   </Tabs>

<Note>
  If the client where you work requires a certificate, use the certificate that your machine's OS provides. For example, check the `/etc/ssl/` folder for macOS.
</Note>
