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
    • Creating a cluster
    • Connecting to a database
    • Updating a cluster
    • Managing cluster hosts
    • Managing shards
    • Managing backups
    • Maintenance
    • Viewing cluster logs
    • Deleting a cluster
  • Access management
  • Pricing policy
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Restoring a cluster from a backup
  • Creating a backup
  • Getting a list of backups
  • Getting backup details
  • Setting the backup start time
  • Setting a retention period for automatic backups
  • Deleting a backup
  1. Step-by-step guides
  2. Managing backups

Managing backups in Yandex Managed Service for Sharded PostgreSQL

Written by
Yandex Cloud
Updated at March 31, 2026
  • Restoring a cluster from a backup
  • Creating a backup
  • Getting a list of backups
  • Getting backup details
  • Setting the backup start time
  • Setting a retention period for automatic backups
  • Deleting a backup

Note

The service is at the Preview stage.

You can create backups and use existing backups to restore your clusters.

Managed Service for Sharded PostgreSQL automatically takes a daily backup as well. You can specify the start time and configure the retention period for automatic backups.

Restoring a cluster from a backupRestoring a cluster from a backup

Warning

For clusters running an unsupported DBMS version, restoring from backups is not available.

Management console
CLI
REST API
gRPC API

To restore an existing cluster from a backup:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.

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

  3. Click in the row with the backup you need and select Restore cluster.

  4. Configure the new cluster.

    You can select a folder for the new cluster in the Folder field.

  5. Click Restore cluster.

To restore a deleted cluster from a backup:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.

  2. In the left-hand panel, select Backups.

  3. Click in the row with the backup you need and select Restore cluster.

  4. Configure the new cluster.

    You can select a folder for the new cluster in the Folder field.

  5. Click Restore cluster.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To restore a cluster from a backup:

  1. View the description of the CLI command for restoring a cluster:

    yc managed-sharded-postgresql cluster restore --help
    
  2. Create a cluster from a backup (the example does not include all the available flags):

    yc managed-sharded-postgresql cluster restore \
      --backup-id <backup_ID> \
      --time <time_point_to_restore_to> \
      --name <cluster_name> \
      --description <cluster_description> \
      --environment <environment> \
      --network-id <network_ID> \
      --host zone-id=<availability_zone>,`
            `subnet-id=<subnet_ID>,`
            `assign-public-ip=<public_access_to_host>,`
            `type=<host_type> \
      --router-resource-preset <router_host_class> \
      --router-disk-size <storage_size_in_GB> \
      --router-disk-type <disk_type> \
      --coordinator-resource-preset <coordinator_host_class> \
      --coordinator-disk-size <storage_size_in_GB> \
      --coordinator-disk-type <disk_type> \
      --infra-resource-preset <INFRA_host_class> \
      --infra-disk-size <storage_size_in_GB> \
      --infra-disk-type <disk_type> \
      --backup-window-start <backup_start_time> \
      --backup-retain-period-days <backup_retention_period> \
      --security-group-ids <security_group_IDs> \
      --deletion-protection
    

    Where:

    • --backup-id: Backup ID.

      You can get the backup ID with the list of backups.

    • --time: Point in time to restore the cluster to, in yyyy-mm-ddThh:mm:ssZ format.

    • --name: Cluster name.

    • --description: Cluster description.

    • --environment: Cluster environment, PRODUCTION or PRESTABLE.

    • --network-id: ID of the network the cluster will be deployed in.

    • --host: Host settings:

      • zone-id: Availability zone.

      • subnet-id: Subnet ID.

      • assign-public-ip: Permission to connect to the host from the internet, true or false.

      • type: Host type. The possible values are:

        • ROUTER: Router in a cluster with advanced sharding.
        • COORDINATOR: Coordinator in a cluster with advanced sharding.
        • INFRA: INFRA host in a cluster with standard sharding.
    • --router-resource-preset: Class of router hosts.

    • --router-disk-size: Storage size for router hosts, GB.

    • --router-disk-type: Disk type for router hosts.

    • --coordinator-resource-preset: Class of coordinator hosts.

    • --coordinator-disk-size: Storage size for coordinator hosts, GB.

    • --coordinator-disk-type: Disk type for coordinator hosts.

    • --infra-resource-preset: INFRA host class.

    • --infra-disk-size: INFRA storage size, GB.

    • --infra-disk-type: Disk type for INFRA hosts.

    • --backup-window-start: Daily backup start time (UTC) in HH:MM:SS format.

    • --backup-retain-period-days: Retention period of automatic cluster backups. Possible values: between 7 and 60 days. The default value is 7.

    • --security-group-ids: Security group IDs.

      Warning

      For the router to be able to connect to your shard hosts, the Managed Service for Sharded PostgreSQL cluster and the shards and must be in the same security group that allows incoming and outgoing TCP connections to port 6432.

    • --deletion-protection: Enables cluster deletion protection.

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

    export IAM_TOKEN="<IAM_token>"
    
  2. Create a file named body.json and paste the following code into it:

    {
      "backupId": "<backup_ID>",
      "name": "<cluster_name>",
      "description": "<cluster_description>",
      "environment": "<environment>",
      "configSpec": {
        "spqrSpec": {
          "router": {
            "resources": {
              "resourcePresetId": "<router_host_class>",
              "diskSize": "<storage_size_in_bytes>",
              "diskTypeId": "<disk_type>"
            }
          },
          "coordinator": {
            "resources": {
              "resourcePresetId": "<coordinator_host_class>",
              "diskSize": "<storage_size_in_bytes>",
              "diskTypeId": "<disk_type>"
            }
          },
          "infra": {
            "resources": {
              "resourcePresetId": "<INFRA_host_class>",
              "diskSize": "<storage_size_in_bytes>",
              "diskTypeId": "<disk_type>"
            }
          },
          "consolePassword": "<Sharded_PostgreSQL_console_password>",
          "logLevel": "<logging_level>"
        },
        "backupWindowStart": {
          "hours": <hours>,
          "minutes": <minutes>,
          "seconds": <seconds>,
          "nanos": <nanoseconds>
        },
        "backupRetainPeriodDays": "<number_of_days>"
      },
      "hostSpecs": [
        {
          "zoneId": "<availability_zone>",
          "subnetId": "<subnet_ID>",
          "assignPublicIp": <allow_public_access_to_host>,
          "type": "<host_type>",
          "shardName": "<shard_name>",
          "mdbPostgresql": {
            "clusterId": "<PostgreSQL_cluster_ID>"
          }
        },
        { <similar_settings_for_host_2> },
        { ... },
        { <similar_settings_for_host_N> }
      ],
      "networkId": "<network_ID>",
      "folderId": "<folder_ID>",
      "securityGroupIds": [
        "<security_group_1_ID>",
        "<security_group_2_ID>",
        ...
        "<security_group_N_ID>"
      ],
      "deletionProtection": <protect_cluster_from_deletion>,
      "time": "<time_point_to_restore_to>",
      "timeInclusive": <restore_after_specified_time>
    }
    

    Where:

    • backupId: Backup ID.

      You can get the backup ID with the list of backups.

    • name: Cluster name.

    • description: Cluster description.

    • environment: Cluster environment, PRODUCTION or PRESTABLE.

    • configSpec.spqrSpec.router.resources: Parameters of router host resources:

      • resourcePresetId: Host class.
      • diskSize: Disk size, in bytes.
      • diskTypeId: Disk type.
    • configSpec.spqrSpec.coordinator.resources: Parameters of coordinator host resources:

      • resourcePresetId: Host class.
      • diskSize: Disk size, in bytes.
      • diskTypeId: Disk type.
    • configSpec.spqrSpec.infra.resources: INFRA host resource parameters:

      • resourcePresetId: Host class.
      • diskSize: Disk size, in bytes.
      • diskTypeId: Disk type.
    • configSpec.spqrSpec.consolePassword: Sharded PostgreSQL console password.

    • configSpec.spqrSpec.logLevel: Query logging level: DEBUG, INFO, WARNING, ERROR, or FATAL.

    • configSpec.backupWindowStart: Backup window settings.

      Here, specify the backup start time. Allowed values:

      • hours: Between 0 and 23 hours.
      • minutes: Between 0 and 59 minutes.
      • seconds: Between 0 and 59 seconds.
      • nanos: Between 0 and 999999999 nanoseconds.
    • configSpec.backupRetainPeriodDays: Retention period of automatic cluster backups. Possible values: between 7 and 60 days. The default value is 7.

    • hostSpecs: Cluster host settings as an array of elements, one per host. Each element has the following structure:

      • zoneId: Availability zone.

      • subnetId: Subnet ID.

      • assignPublicIp: Permission to connect to the host from the internet, true or false.

      • type: Host type. The possible values are:

        • ROUTER: Router in a cluster with advanced sharding.
        • COORDINATOR: Coordinator in a cluster with advanced sharding.
        • INFRA: INFRA host in a cluster with standard sharding.
      • shardName: Shard name.

      • mdbPostgresql.clusterId: Managed Service for PostgreSQL cluster ID.

        You can get the Managed Service for PostgreSQL cluster ID with the list of clusters in the folder.

    • networkId: ID of the network the cluster will be deployed in.

    • folderId: Folder ID.

      You can get the folder ID with the list of folders in the cloud.

    • securityGroupIds: Security group IDs.

      Warning

      For the router to be able to connect to your shard hosts, the Managed Service for Sharded PostgreSQL cluster and the shards and must be in the same security group that allows incoming and outgoing TCP connections to port 6432.

    • deletionProtection: Cluster deletion protection, true or false.

    • time: Point in time to restore the cluster to, in yyyy-mm-ddThh:mm:ssZ format.

    • timeInclusive: Restore the cluster after the specified time, true or false.

  3. Call the Cluster.Restore method, e.g., via the following cURL request:

    curl \
      --request POST \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters:restore' \
      --data "@body.json"
    
  4. 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. Create a file named body.json and paste the following code into it:

    {
      "backup_id": "<backup_ID>",
      "name": "<cluster_name>",
      "description": "<cluster_description>",
      "environment": "<environment>",
      "config_spec": {
        "spqr_spec": {
          "router": {
            "resources": {
              "resource_preset_id": "<router_host_class>",
              "disk_size": <storage_size_in_bytes>,
              "disk_type_id": "<disk_type>"
            }
          },
          "coordinator": {
            "resources": {
              "resource_preset_id": "<coordinator_host_class>",
              "disk_size": <storage_size_in_bytes>,
              "disk_type_id": "<disk_type>"
            }
          },
          "infra": {
            "resources": {
              "resource_preset_id": "<INFRA_host_class>",
              "disk_size": <storage_size_in_bytes>,
              "disk_type_id": "<disk_type>"
            }
          },
          "console_password": "<Sharded_PostgreSQL_console_password>",
          "log_level": "<logging_level>"
        },
        "backup_window_start": {
          "hours": <hours>,
          "minutes": <minutes>,
          "seconds": <seconds>,
          "nanos": <nanoseconds>
        },
        "backup_retain_period_days": <number_of_days>
      },
      "host_specs": [
        {
          "zone_id": "<availability_zone>",
          "subnet_id": "<subnet_ID>",
          "assign_public_ip": <allow_public_access_to_host>,
          "type": "<host_type>",
          "shard_name": "<shard_name>",
          "mdb_postgresql": {
            "cluster_id": "<PostgreSQL_cluster_ID>"
          }
        },
        { <similar_settings_for_host_2> },
        { ... },
        { <similar_settings_for_host_N> }
      ],
      "network_id": "<network_ID>",
      "folder_id": "<folder_ID>",
      "security_group_ids": [
        "<security_group_1_ID>",
        "<security_group_2_ID>",
        ...
        "<security_group_N_ID>"
      ],
      "deletion_protection": <protect_cluster_from_deletion>,
      "time": "<time_point_to_restore_to>",
      "time_inclusive": <restore_after_specified_time>
    }
    

    Where:

    • backup_id: Backup ID.

      You can get the backup ID with the list of backups.

    • name: Cluster name.

    • description: Cluster description.

    • environment: Cluster environment, PRODUCTION or PRESTABLE.

    • config_spec.spqr_spec.router.resources: Parameters of router host resources:

      • resource_preset_id: Host class.
      • disk_size: Disk size, in bytes.
      • disk_type_id: Disk type.
    • config_spec.spqr_spec.coordinator.resources: Parameters of coordinator host resources:

      • resource_preset_id: Host class.
      • disk_size: Disk size, in bytes.
      • disk_type_id: Disk type.
    • config_spec.spqr_spec.infra.resources: INFRA host resource parameters:

      • resource_preset_id: Host class.
      • disk_size: Disk size, in bytes.
      • disk_type_id: Disk type.
    • config_spec.spqr_spec.console_password: Sharded PostgreSQL console password.

    • config_spec.spqr_spec.log_level: Query logging level: DEBUG, INFO, WARNING, ERROR, or FATAL.

    • config_spec.backup_window_start: Backup window settings.

      Here, specify the backup start time. Allowed values:

      • hours: Between 0 and 23 hours.
      • minutes: Between 0 and 59 minutes.
      • seconds: Between 0 and 59 seconds.
      • nanos: Between 0 and 999999999 nanoseconds.
    • config_spec.backup_retain_period_days: Retention period of automatic cluster backups. Possible values: between 7 and 60 days.

    • host_specs: Cluster host settings as an array of elements, one per host. Each element has the following structure:

      • zone_id: Availability zone.

      • subnet_id: Subnet ID.

      • assign_public_ip: Permission to connect to the host from the internet, true or false.

      • type: Host type. The possible values are:

        • ROUTER: Router in a cluster with advanced sharding.
        • COORDINATOR: Coordinator in a cluster with advanced sharding.
        • INFRA: INFRA host in a cluster with standard sharding.
      • shard_name: Shard name.

      • mdb_postgresql.cluster_id: Managed Service for PostgreSQL cluster ID.

        You can get the Managed Service for PostgreSQL cluster ID with the list of clusters in the folder.

    • network_id: ID of the network the cluster will be deployed in.

    • folder_id: Folder ID.

      You can get the folder ID with the list of folders in the cloud.

    • security_group_ids: Security group IDs.

      Warning

      For the router to be able to connect to your shard hosts, the Managed Service for Sharded PostgreSQL cluster and the shards and must be in the same security group that allows incoming and outgoing TCP connections to port 6432.

    • deletion_protection: Cluster deletion protection, true or false.

    • time: Point in time to restore the cluster to, in yyyy-mm-ddThh:mm:ssZ format.

    • time_inclusive: Restore the cluster after the specified time, true or false.

  4. Call the ClusterService.Restore 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/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d @ \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.ClusterService.Restore \
      < body.json
    
  5. Check the server response to make sure your request was successful.

Creating a backupCreating a backup

Management console
CLI
REST API
gRPC API
  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. Click the name of your cluster and select the Backups tab.
  3. Click Create backup in the top-right corner of the page.
  4. Confirm the creation of a backup.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To create a cluster backup:

  1. See the description of the CLI command for creating a cluster backup:

    yc managed-sharded-postgresql cluster backup --help
    
  2. Create a cluster backup:

    yc managed-sharded-postgresql cluster backup <cluster_name_or_ID>
    
  1. Get an IAM token for API authentication and put it into an environment variable:

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

    curl \
      --request POST \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>:backup'
    
  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 ClusterService.Backup 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/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.ClusterService.Backup
    
  4. Check the server response to make sure your request was successful.

Getting a list of backupsGetting a list of backups

Management console
CLI
REST API
gRPC API

To get a list of backups for a specific cluster:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. Click the name of your cluster and select the Backups tab.

To get a list of backups for all Managed Service for Sharded PostgreSQL clusters in a folder:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. In the left-hand panel, select Backups.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To get a list of backups for a specific cluster:

  1. See the description of the CLI command for getting a list of cluster backups:

    yc managed-sharded-postgresql cluster list-backups --help
    
  2. Get a list of cluster backups:

    yc managed-sharded-postgresql cluster list-backups <cluster_name_or_ID>
    

To get a list of backups for all Managed Service for Sharded PostgreSQL clusters in a folder:

  1. See the description of the CLI command for getting a list of backups:

    yc managed-sharded-postgresql backup list --help
    
  2. Get a list of backups:

    yc managed-sharded-postgresql backup list
    
  1. Get an IAM token for API authentication and put it into an environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. To get a list of backups for a specific cluster:

    1. Call the Cluster.ListBackups 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>/backups'
      
    2. Check the server response to make sure your request was successful.

  3. To get a list of backups for all Managed Service for Sharded PostgreSQL clusters in a folder:

    1. Call the Backup.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/backups' \
        --url-query folderId=<folder_ID>
      

      You can get the folder ID with the list of folders in the cloud.

    2. 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. To get a list of backups for a specific cluster:

    1. Call the ClusterService.ListBackups 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/cluster_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "cluster_id": "<cluster_ID>"
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.spqr.v1.ClusterService.ListBackups
      
    2. Check the server response to make sure your request was successful.

  4. To get a list of backups for all Managed Service for Sharded PostgreSQL clusters in a folder:

    1. Call the BackupService.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/backup_service.proto \
        -rpc-header "Authorization: Bearer $IAM_TOKEN" \
        -d '{
              "folder_id": "<folder_ID>"
            }' \
        mdb.api.cloud.yandex.net:443 \
        yandex.cloud.mdb.spqr.v1.BackupService.List
      

      You can get the folder ID with the list of folders in the cloud.

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

Getting backup detailsGetting backup details

Management console
CLI
REST API
gRPC API

To get backup details for an existing cluster:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. Click the name of your cluster and select the Backups tab.

To get backup details for a deleted cluster:

  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. In the left-hand panel, select Backups.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To get details for a specific backup:

  1. See the description of the CLI command for getting backup details:

    yc managed-sharded-postgresql backup get --help
    
  2. Get backup details:

    yc managed-sharded-postgresql backup get <backup_ID>
    

    You can get the backup ID with the list of backups.

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

    export IAM_TOKEN="<IAM_token>"
    
  2. Call the Backup.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/backups/<backup_ID>'
    

    You can get the backup ID with the list of backups.

  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 BackupService.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/backup_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "backup_id": "<backup_ID>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.BackupService.Get
    

    You can get the backup ID with the list of backups.

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

Setting the backup start timeSetting the backup start time

Management console
CLI
REST API
gRPC API

In the management console, you can set the backup start time when creating or updating a cluster.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To set the backup start time:

  1. View the description of the CLI command for updating a cluster:

    yc managed-sharded-postgresql cluster update --help
    
  2. Set the backup start time:

    yc managed-sharded-postgresql cluster update <cluster_name_or_ID> \
      --backup-window-start <backup_start_time>
    

    Where --backup-window-start is the daily backup start time (UTC) in HH:MM:SS format.

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

    export IAM_TOKEN="<IAM_token>"
    
  2. Create a file named body.json and paste the following code into it:

    {
      "updateMask": "configSpec.backupWindowStart",
      "configSpec": {
        "backupWindowStart": {
          "hours": <hours>,
          "minutes": <minutes>,
          "seconds": <seconds>,
          "nanos": <nanoseconds>
        }
      }
    }
    

    Where:

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

      In this example, only the configSpec.backupWindowStart setting is provided.

      Warning

      When you update a cluster, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the updateMask parameter.

    • configSpec.backupWindowStart: Backup window settings.

      Here, specify the backup start time. Allowed values:

      • hours: Between 0 and 23 hours.
      • minutes: Between 0 and 59 minutes.
      • seconds: Between 0 and 59 seconds.
      • nanos: Between 0 and 999999999 nanoseconds.
  3. Call the Cluster.Update method, e.g., via the following cURL request:

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>' \
      --data "@body.json"
    
  4. 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. Create a file named body.json and paste the following code into it:

    {
      "update_mask": {
        "paths": [
          "config_spec.backup_window_start"
        ]
      },
      "config_spec": {
        "backup_window_start": {
          "hours": <hours>,
          "minutes": <minutes>,
          "seconds": <seconds>,
          "nanos": <nanoseconds>
        }
      }
    }
    

    Where:

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

      Format for listing settings
      "update_mask": {
        "paths": [
          "<setting_1>",
          "<setting_2>",
          ...
          "<setting_N>"
        ]
      }
      

      In this example, only the config_spec.backup_window_start setting is provided.

      Warning

      When you update a cluster, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the update_mask parameter.

    • config_spec.backup_window_start: Backup window settings.

      Here, specify the backup start time. Allowed values:

      • hours: Between 0 and 23 hours.
      • minutes: Between 0 and 59 minutes.
      • seconds: Between 0 and 59 seconds.
      • nanos: Between 0 and 999999999 nanoseconds.
  4. Call the ClusterService.Update 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/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d @ \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.ClusterService.Update \
      < body.json
    
  5. Check the server response to make sure your request was successful.

Setting a retention period for automatic backupsSetting a retention period for automatic backups

Management console
CLI
REST API
gRPC API

You can set the retention period for automatic backups when you create or update the cluster via the management console.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To set a retention period for automatic backups:

  1. View the description of the CLI command for updating a cluster:

    yc managed-sharded-postgresql cluster update --help
    
  2. Set a retention period for automatic backups:

    yc managed-sharded-postgresql cluster update <cluster_name_or_ID> \
      --backup-retain-period-days <number_of_days>
    

    Where --backup-retain-period-days is the retention period of automatic cluster backups. Possible values: between 7 and 60 days. The default value is 7.

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

    export IAM_TOKEN="<IAM_token>"
    
  2. Create a file named body.json and paste the following code into it:

    {
      "updateMask": "configSpec.backupRetainPeriodDays",
      "configSpec": {
        "backupRetainPeriodDays": "<number_of_days>"
      }
    }
    

    Where:

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

      In this example, only the configSpec.backupRetainPeriodDays setting is provided.

      Warning

      When you update a cluster, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the updateMask parameter.

    • backupRetainPeriodDays: Retention period of automatic cluster backups. Possible values: between 7 and 60 days. The default value is 7.

  3. Call the Cluster.Update method, e.g., via the following cURL request:

    curl \
      --request PATCH \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/clusters/<cluster_ID>' \
      --data "@body.json"
    
  4. 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. Create a file named body.json and paste the following code into it:

    {
      "update_mask": {
        "paths": [
          "config_spec.backup_retain_period_days"
        ]
      },
      "config_spec": {
        "backup_retain_period_days": <number_of_days>
      }
    }
    

    Where:

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

      Format for listing settings
      "update_mask": {
        "paths": [
          "<setting_1>",
          "<setting_2>",
          ...
          "<setting_N>"
        ]
      }
      

      In this example, only the config_spec.backup_retain_period_days setting is provided.

      Warning

      When you update a cluster, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the update_mask parameter.

    • config_spec.backup_retain_period_days: Retention period of automatic cluster backups. Possible values: between 7 and 60 days. The default value is 7.

  4. Call the ClusterService.Update 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/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d @ \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.ClusterService.Update \
      < body.json
    
  5. Check the server response to make sure your request was successful.

Deleting a backupDeleting a backup

You can only delete manual backups.

Management console
CLI
REST API
gRPC API
  1. Navigate to the folder dashboard and select Yandex Managed Service for Sharded PostgreSQL.
  2. Click the name of your cluster and select the Backups tab.
  3. Click next to the backup you want to delete and select Delete backup.
  4. Confirm deleting the backup.

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

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id options.

To delete a backup:

  1. View a description of the CLI delete backup command:

    yc managed-sharded-postgresql backup delete --help
    
  2. Delete the backup:

    yc managed-sharded-postgresql backup delete <backup_ID>
    

    You can get the backup ID with the list of backups.

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

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

    curl \
      --request DELETE \
      --header "Authorization: Bearer $IAM_TOKEN" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-spqr/v1/backups/<backup_ID>'
    

    You can get the backup ID with the list of backups.

  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 BackupService.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/backup_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "backup_id": "<backup_ID>"
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.spqr.v1.BackupService.Delete
    

    You can get the backup ID with the list of backups.

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

Was the article helpful?

Previous
Managing shards
Next
Maintenance
© 2026 Direct Cursus Technology L.L.C.