Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • 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
© 2026 Direct Cursus Technology L.L.C.
Yandex Managed Service for Sharded PostgreSQL
  • Getting started
    • All guides
    • Getting information on existing clusters
    • Creating a cluster
    • Connecting to a database
    • Managing cluster access
    • Updating a cluster
    • Managing cluster hosts
    • Managing shards
    • Managing backups
    • Maintenance
    • Viewing cluster logs
    • Deleting a cluster
    • Managing users
    • Managing databases
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Getting a list of users
  • Getting user info
  • Creating a user
  • Changing user settings
  • Changing a user password
  • Configuring deletion protection
  • Deleting a user
  1. Step-by-step guides
  2. Managing users

User management in Sharded PostgreSQL

Written by
Yandex Cloud
Updated at April 9, 2026
  • Getting a list of users
  • Getting user info
  • Creating a user
  • Changing user settings
  • Changing a user password
  • Configuring deletion protection
  • Deleting a user

You can add and remove users, as well as manage their individual settings.

Getting a list of usersGetting a list of users

Management console
REST API
gRPC API
  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.
  2. Click the name of your cluster and select the Users tab.
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.List method, e.g., via the following cURL request:

    curl \
      --request GET \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users'
    
  3. View the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.List method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.List
    
  4. Check the server response to make sure your request was successful.

Getting user infoGetting user info

REST API
gRPC API
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Get method, e.g., via the following cURL request:

    curl \
      --request GET \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users/<username>'
    
  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Get method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_name": "<username>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Get
    
  4. Check the server response to make sure your request was successful.

Creating a userCreating a user

Management console
REST API
gRPC API
  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.

  2. Click the name of your cluster and select the Users tab.

  3. Click Create user.

  4. Specify the database user name.

    The username may contain Latin letters, numbers, hyphens, and underscores. It must start with a letter, number, or underscore, but cannot begin with a pg_ prefix. The name may be up to 63 characters long.

    The following names are reserved: admin, repl, monitor, postgres, mdb_admin, mdb_monitor, mdb_replication. You cannot create users with these names.

  5. Enter a password. It must be from 8 to 128 characters long.

  6. Set the maximum number of user connections to the database.

  7. Set the number of reconnect attempts from the router to the shards.

  8. Select one or more grants to assign to the user.

    The possible values are:

    • reader
    • writer
    • admin
    • transfer
  9. Select the deletion protection option.

    The possible values are:

    • Like the cluster
    • Enabled
    • DIsabled
  10. Select which databases the user should have access to:

    1. In the Database field, click next to the drop-down list.
    2. Select the database from the drop-down list.
    3. Repeat these two steps to select all required databases.
    4. To delete a database added by mistake, click next to its name.
  11. Click Create.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Create method, e.g., via the following cURL request:

    curl \
      --request POST \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users' \
      --data '{
                "userSpec": {
                  "name": "<username>",
                  "password": "<user_password>",
                  "permissions": [
                    {
                      "databaseName": "<DB_name>"
                    }
                  ],
                  "settings": {
                    "connectionLimit": "<maximum_number_of_DB_connections>",
                    "connectionRetries": "<number_of_reconnect_attempts_to_shards>"
                  },
                  "grants": [
                    "<list_of_grants>"
                  ],
                  "deletionProtection": "<protect_user_from_deletion>"
                }
              }'
    

    Where userSpec are the settings for the new database user:

    • name: Username.

      The username may contain Latin letters, numbers, hyphens, and underscores. It must start with a letter, number, or underscore, but cannot begin with a pg_ prefix. The name may be up to 63 characters long.

      The following names are reserved: admin, repl, monitor, postgres, mdb_admin, mdb_monitor, mdb_replication. You cannot create users with these names.

    • password: User password. The password must be from 8 to 128 characters long.

    • permissions: List of databases the user needs access to. Each element in the list contains the databaseName parameter, which is the database name.

    • settings: Connection settings:

      • connLimit: Maximum number of user connections to the database.
      • connectionRetries: Number of reconnect attempts from the router to the shards.
    • grants: List of grants to be assigned to the user.

      The possible values are:

      • reader
      • writer
      • admin
      • transfer
    • deletionProtection: User deletion protection, true or false.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Create method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_spec": {
              "name": "<username>",
              "password": "<user_password>",
              "permissions": [
                {
                  "database_name": "<DB_name>"
                }
              ],
              "settings": {
                "connection_limit": "<maximum_number_of_DB_connections>",
                "connection_retries": "<number_of_reconnect_attempts_to_shards>"
              },
              "grants": [
                "<list_of_grants>"
              ],
              "deletion_protection": "<protect_user_from_deletion>"
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Create
    

    Where user_spec are the new database user settings:

    • name: Username.

      The username may contain Latin letters, numbers, hyphens, and underscores. It must start with a letter, number, or underscore, but cannot begin with a pg_ prefix. The name may be up to 63 characters long.

      The following names are reserved: admin, repl, monitor, postgres, mdb_admin, mdb_monitor, mdb_replication. You cannot create users with these names.

    • password: User password. The password must be from 8 to 128 characters long.

    • permissions: List of databases the user needs access to. Each element in the list contains the database_name parameter, which is the database name.

    • settings: Connection settings:

      • connection_limit: Maximum number of user connections to the database.
      • connection_retries: Number of reconnect attempts from the router to the shards.
    • grants: List of grants to be assigned to the user.

      The possible values are:

      • reader
      • writer
      • admin
      • transfer
    • deletion_protection: User deletion protection, true or false.

  4. Check the server response to make sure your request was successful.

Changing user settingsChanging user settings

Management console
REST API
gRPC API
  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.

  2. Click the name of your cluster and select the Users tab.

  3. Locate the user you need in the list, click in their row, and select Configure.

  4. Change the maximum number of user connections to the database.

  5. Change the number of reconnect attempts from the router to the shards.

  6. Configure the grants assigned to the user.

    The possible values are:

    • reader
    • writer
    • admin
    • transfer
  7. Configure the deletion protection type.

    The possible values are:

    • Like the cluster
    • Enabled
    • DIsabled
  8. Configure user access to databases:

    1. To provide access to databases:
      1. In the Database field, click next to the drop-down list.
      2. Select the database from the drop-down list.
      3. Repeat the previous two steps until all the required databases are selected.
    2. To revoke user access to a database, click next to its name.
  9. Click Save.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Update method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users/<username>' \
      --data '{
                "updateMask": "<list_of_parameters_to_update>",
                "password": "<user_password>",
                "permissions": [
                  {
                    "databaseName": "<DB_name>"
                  }
                ],
                "settings": {
                  "connectionLimit": "<maximum_number_of_DB_connections>",
                  "connectionRetries": "<number_of_reconnect_attempts_to_shards>"
                },
                "grants": [
                  "<list_of_grants>"
                ],
                "deletionProtection": "<protect_user_from_deletion>"
              }'
    

    Where:

    • updateMask: Comma-separated string of settings you want to update.

    • password: New password. It must be from 8 to 128 characters long.

    • permissions: List of databases the user needs access to. Each element in the list contains the databaseName parameter, which is the database name.

    • settings: Connection settings:

      • connLimit: Maximum number of user connections to the database.
      • connectionRetries: Number of reconnect attempts from the router to the shards.
    • grants: List of grants to be assigned to the user.

      The possible values are:

      • reader
      • writer
      • admin
      • transfer
    • deletionProtection: User deletion protection, true or false.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Update method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_name": "<username>",
            "update_mask": {
              "paths": [
                "<array_of_settings_to_update>"
              ]
            },
            "password": "<user_password>",
            "permissions": [
              {
                "database_name": "<DB_name>"
              }
            ],
            "settings": {
              "connection_limit": "<maximum_number_of_DB_connections>",
              "connection_retries": "<number_of_reconnect_attempts_to_shards>"
            },
            "grants": [
              "<list_of_grants>"
            ],
            "deletion_protection": "<protect_user_from_deletion>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Update
    

    Where:

    • update_mask: List of settings to update as an array of strings (paths[]).

    • password: Password. The password must be from 8 to 128 characters long.

    • permissions: List of databases the user needs access to. Each element in the list contains the database_name parameter, which is the database name.

    • settings: Connection settings:

      • connection_limit: Maximum number of user connections to the database.
      • connection_retries: Number of reconnect attempts from the router to the shards.
    • grants: List of grants to be assigned to the user.

      The possible values are:

      • reader
      • writer
      • admin
      • transfer
    • deletion_protection: User deletion protection, true or false.

  4. Check the server response to make sure your request was successful.

Changing a user passwordChanging a user password

Management console
REST API
gRPC API
  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.
  2. Click the name of your cluster and select the Users tab.
  3. Locate the user you need in the list, click in their row, and select Change password.
  4. Specify a new password. It must be from 8 to 128 characters long.
  5. Click Edit.
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Update method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users/<username>' \
      --data '{
                "updateMask": "password",
                "password": "<new_password>"
              }'
    

    Where:

    • updateMask: Comma-separated string of settings to update.

      Here, we provide only one setting.

    • password: New password. It must be from 8 to 128 characters long.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Update method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_name": "<username>",
            "update_mask": {
              "paths": [
                "password"
              ]
            },
            "password": "<new_password>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

      Here, we provide only one setting.

    • password: New password. It must be from 8 to 128 characters long.

  4. Check the server response to make sure your request was successful.

Configuring deletion protectionConfiguring deletion protection

Management console
REST API
gRPC API
  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.
  2. Click the name of your cluster and select the Users tab.
  3. Locate the user you need in the list, click in their row, and select Configure.
  4. Change the deletion protection type in the Deletion protection field.
  5. Click Save.
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Update method, e.g., via the following cURL request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the updateMask parameter as a single comma-separated string.

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users/<username>' \
      --data '{
                "updateMask": "deletionProtection",
                "deletionProtection": "<protect_user_from_deletion>"
              }'
    

    Where:

    • updateMask: Comma-separated string of settings to update.

      Here, we provide only one setting.

    • deletionProtection: User deletion protection, true or false.

  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Update method, e.g., via the following gRPCurl request:

    Warning

    The API method will assign default values to all the parameters of the object you are modifying unless you explicitly provide them in your request. To avoid this, list the settings you want to change in the update_mask parameter as an array of paths[] strings.

    Format for listing settings
    "update_mask": {
        "paths": [
            "<setting_1>",
            "<setting_2>",
            ...
            "<setting_N>"
        ]
    }
    
    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_name": "<username>",
            "update_mask": {
              "paths": [
                "deletion_protection"
              ]
            },
            "deletion_protection": "<protect_user_from_deletion>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Update
    

    Where:

    • update_mask: List of settings you want to update as an array of strings (paths[]).

      Here, we provide only one setting.

    • deletion_protection: User deletion protection, true or false.

  4. Check the server response to make sure your request was successful.

Deleting a userDeleting a user

A user account can have deletion protection enabled. To delete such a user, disable the protection first.

Management console
REST API
gRPC API

To delete a user:

  1. Navigate to the Yandex Managed Service for Sharded PostgreSQL service.
  2. Click the name of your cluster and select the Users tab.
  3. Locate the user you need in the list, click in their row, and select Delete.
  4. Confirm the deletion.
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the User.Delete method, e.g., via the following cURL request:

    curl \
      --request DELETE \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>/users/<username>'
    
  3. Check the server response to make sure your request was successful.

  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Clone the cloudapi repository:

    cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapi
    

    Below, we assume that the repository contents reside in the ~/cloudapi/ directory.

  3. Call the UserService.Delete method, e.g., via the following gRPCurl request:

    grpcurl \
      -format json \
      -import-path ~/cloudapi/ \
      -import-path ~/cloudapi/third_party/googleapis/ \
      -proto ~/cloudapi/yandex/cloud/mdb/spqr/v1/user_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "user_name": "<username>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.UserService.Delete
    
  4. Check the server response to make sure your request was successful.

Was the article helpful?

Previous
Deleting a cluster
Next
Managing databases
© 2026 Direct Cursus Technology L.L.C.