Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Managed Service for YTsaurus
  • Getting started
    • All guides
    • Information about existing clusters
    • Creating a cluster
    • Connecting to a cluster
    • Updating a cluster
    • Stopping and starting a cluster
    • Deleting a cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Audit Trails events
  • Release notes

In this article:

  • Examples of connection strings
  • Bash
  • Go
  • Python
  1. Step-by-step guides
  2. Connecting to a cluster

Connecting to a cluster YTsaurus

Written by
Yandex Cloud
Updated at November 13, 2025
  • Examples of connection strings
    • Bash
    • Go
    • Python

Note

The service is at the Preview stage.

You can connect to a YTsaurus cluster:

  • From Yandex Cloud VMs.
  • Via the internet over HTTPS.

Examples of connection stringsExamples of connection strings

The examples for Linux were tested in the following environment:

  • Yandex Cloud VM running Ubuntu 20.04 LTS.
  • Bash: 5.0.16.
  • Python: 3.8.2; pip3: 20.0.2.
  • Go: 1.24.8.

BashBash

Before connecting:

  1. If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

  2. Install the YTsaurus CLI according to the instructions.

  3. Install the dependencies:

    sudo apt update && sudo apt install -y python3 python3-pip && \
    pip3 install ytsaurus-client-yc-auth
    
Connecting from a user VM
Connecting from the internet
  1. Get the access configuration file using the following YC CLI command:

    yc managed-ytsaurus cluster get-configuration <cluster_name_or_ID> --private
    
    Configuration file example
    {
      auth_class = {
        module_name = "yc_managed_ytsaurus_auth";
        class_name = "IamTokenAuth";
      };
      proxy = {
        url = "http://hp.<YTsaurus_cluster_ID>.ytsaurus.mdb.yandexcloud.net:32100";
        network_name = "external";
        http_proxy_role = "default";
      }
    }
    

    The configuration file will be saved to ~/.yt/config.

    You can get the cluster ID with the list of clusters in the folder.

  2. Run a request for the root directory contents list:

    yt list /
    
  1. Get the access configuration file using the following YC CLI command:

    yc managed-ytsaurus cluster get-configuration <cluster_name_or_ID>
    
    Configuration file example
    {
      auth_class = {
        module_name = "yc_managed_ytsaurus_auth";
        class_name = "IamTokenAuth";
      };
      proxy = {
        url = "https://<YTsaurus_cluster_ID>.proxy.ytsaurus.yandexcloud.net";
        enable_proxy_discovery = %false;
      }
    }
    

    The configuration file will be saved to ~/.yt/config.

    You can get the cluster ID with the list of clusters in the folder.

  2. Run a request for the root directory contents list:

    yt list /
    

GoGo

The example uses OAuth token-based authorization.

To connect to your cluster:

  1. Install the dependencies:

    sudo apt update && sudo apt install --yes golang git && \
    go mod init example && go get go.ytsaurus.tech/yt/go
    
  2. Issue an OAuth token.

  3. Prepare a sample file for connection:

    connect.go
    package main
    
    import (
        "context"
        "flag"
        "fmt"
        "time"
    
        ycsdk "github.com/yandex-cloud/go-sdk"
        ytsdk "go.ytsaurus.tech/yt/go/yt"
        ythttpsdk "go.ytsaurus.tech/yt/go/yt/ythttp"
    )
    
    func main() {
        clusterID := flag.String("id", "", "YTsaurus cluster ID")
        token := flag.String("token", "", "OAuth token")
        flag.Parse()
    
        ctx := context.Background()
    
        sdk, err := ycsdk.Build(ctx, ycsdk.Config{
            Credentials: ycsdk.OAuthToken(*token),
        })
        if err != nil {
            panic(err)
        }
    
        iamTokenProvider, err := IamTokenProvider(ctx, sdk)
        if err != nil {
            panic(err)
        }
    
        timeout := 10 * time.Second
        client, err := ythttpsdk.NewClient(&ytsdk.Config{
            Proxy:                 fmt.Sprintf("https://%s.proxy.ytsaurus.yandexcloud.net", *clusterID),
            LightRequestTimeout:   &timeout,
            DisableProxyDiscovery: true,
            CredentialsProviderFn: iamTokenProvider,
        })
        if err != nil {
            panic(err)
        }
    
        res, err := client.WhoAmI(context.Background(), nil)
        if err != nil {
            panic(err)
        }
    
        fmt.Printf("Logged in as %s\n", res.Login)
    }
    
    func IamTokenProvider(ctx context.Context, sdk *ycsdk.SDK) (ytsdk.CredentialsProviderFn, error) {
        var now = time.Now
        tokenMiddleware := ycsdk.NewIAMTokenMiddleware(sdk, now)
        return func(ctx context.Context) (ytsdk.Credentials, error) {
            currentToken, err := tokenMiddleware.GetIAMToken(ctx, false)
            if err != nil {
                return nil, err
            }
            return &ytsdk.BearerCredentials{Token: currentToken}, nil
        }, nil
    }
    
  4. Run this command:

    go run connect.go -id <YTsaurus_cluster_ID> -token <user_OAuth_token>
    

    You can get the cluster ID with the list of clusters in the folder.

PythonPython

Before connecting:

  1. If you do not have the Yandex Cloud CLI installed yet, install and initialize it.

  2. Install the YTsaurus CLI according to the instructions.

  3. Install the dependencies:

    sudo apt update && sudo apt install -y python3 python3-pip && \
    pip3 install ytsaurus-client-yc-auth
    
Connecting from a user VM
Connecting from the internet
  1. Code example:

    connect.py

    import yt.wrapper as yt
    from yc_managed_ytsaurus_auth import with_iam_token_auth
    
    client = yt.YtClient(
        proxy="http://hp.<YTsaurus_cluster_ID>.ytsaurus.mdb.yandexcloud.net:32100",
        config=with_iam_token_auth(
            config={"proxy": {"network_name": "external", "http_proxy_role": "default"}}
        ),
    )
    
    client.list("/")
    
  2. Connecting:

    python3 connect.py
    
  1. Code example:

    connect.py

    import yt.wrapper as yt
    from yc_managed_ytsaurus_auth import with_iam_token_auth
    
    client = yt.YtClient(
        proxy="https://<YTsaurus_cluster_ID>.proxy.ytsaurus.yandexcloud.net",
        config=with_iam_token_auth(config={"proxy": {"enable_proxy_discovery": False}}),
    )
    
    client.list("/")
    
  2. Connecting:

    python3 connect.py
    

Was the article helpful?

Previous
Creating a cluster
Next
Updating a cluster
© 2025 Direct Cursus Technology L.L.C.