Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
All solutions
    • All solutions for Managed Service for YDB
    • Resolving the "RESOURCE_EXHAUSTED" error
    • Resolving the "Unauthenticated" error

In this article:

  • Issue description
  • Solution
  1. Managed YDB
  2. Resolving the "Unauthenticated" error

Resolving the "Unauthenticated" error

Written by
Yandex Cloud
Updated at November 27, 2023
  • Issue description
  • Solution

Issue descriptionIssue description

When trying to access Yandex Managed Service for YDB from a local machine, you see the Unauthenticated error.

SolutionSolution

You can authenticate using an IAM-token or a service account token. You can view code examples here and there.

Note

Example of working with YDB Python SDK:

  1. Create a folder, for example, ydb and navigate to it via PowerShell/Bash: cd ydb. Run subsequent commands in the terminal from this folder.
  2. Create an authorized key for the service account:
    yc iam key create --service-account-id <id_SA> --output token.json. The token.json key will be created in the ydb folder.
  3. Next, check that the key is operable: ydb --endpoint grpcs://ydb.serverless.yandexcloud.net:2135 --database /ru-central1/b1gb4.../etn0fu... --sa-key-file token.json discovery whoami. The response should be: User SID: ajei6s...@as: this means that the connection has been established.
  4. Clone the example from GitHub: git clone https://github.com/ydb-platform/ydb-python-sdk.git. It will be saved in the current ydb folder for convenience.
  5. Install the library: python -m pip install iso8601.
  6. Add the location of this file to the SA_KEY_FILE environment variable:
    • Linux: export SA_KEY_FILE=~/ydb/token.json
    • Windows: $SA_KEY_FILE="C:\Users\<user>\ydb\token.json"
  7. Run the script: python ydb-python-sdk/examples/basic_example_v1/ -e grpcs://ydb.serverless.yandexcloud.net:2135 -d /ru-central1/b1gb4.../etn0fu....

Was the article helpful?

Previous
Resolving the "RESOURCE_EXHAUSTED" error
Next
All solutions for Network Level Balancer
© 2025 Direct Cursus Technology L.L.C.