Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • 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
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 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
    • Fixing error 503 `Service Unavailable`

In this article:

  • Issue description
  • Solution
  1. Managed Service for YDB
  2. Resolving the `Unauthenticated` error

Fixing the Unauthenticated error

Written by
Yandex Cloud
Updated at December 17, 2025
  • Issue description
  • Solution

Issue descriptionIssue description

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

SolutionSolution

You can get authenticated using an IAM token or a service account token. You can see some code examples here or here.

Example of using YDB Python SDK
  1. Create a folder, e.g., ydb, and navigate to it via PowerShell or Bash: cd ydb. You will be running all 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_CA> --output token.json. You will get the token.json key in the ydb folder.

  3. Check the key: ydb --endpoint grpcs://ydb.serverless.yandexcloud.net:2135 --database /ru-central1/b1gb4.../etn0fu... --sa-key-file token.json discovery whoami. You should get User SID: ajei6s...@as in response. This means 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 your convenience.

  5. Install the python -m pip install iso8601 library.

  6. Add the location of this file to the YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS environment variable:

    • Linux: export YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS=~/ydb/token.json
    • Microsoft Windows®: $YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS="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
Fixing error 503 `Service Unavailable`
© 2025 Direct Cursus Technology L.L.C.