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.
Yandex Managed Service for PostgreSQL
  • Getting started
    • All tutorials
      • Getting information on existing clusters
      • Creating a cluster
      • Updating cluster settings
      • Stopping and starting a cluster
      • Managing PostgreSQL hosts
      • Migrating hosts to a different availability zone
      • Managing replication slots
      • Managing backups
      • Managing backup policies
      • Managing disk space
      • Maintenance
      • Updating the PostgreSQL version
      • Deleting a cluster
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes

In this article:

  • Before a version upgrade
  • Upgrading a cluster
  • Upgrading a cluster to PostgreSQL 17
  • Upgrading a cluster to PostgreSQL 16 or lower
  • Examples
  1. Step-by-step tutorials
  2. Clusters
  3. Updating the PostgreSQL version

PostgreSQL version upgrade

Written by
Yandex Cloud
Updated at May 13, 2025
  • Before a version upgrade
  • Upgrading a cluster
    • Upgrading a cluster to PostgreSQL 17
    • Upgrading a cluster to PostgreSQL 16 or lower
  • Examples

You can upgrade a Managed Service for PostgreSQL cluster to version 16 or lower.

Note

You cannot upgrade a regular cluster version to versions optimized for 1C:Enterprise (e.g., from version 14 to version 14-1c).

You can only upgrade to a version that immediately follows the current one, e.g., from version 14 to 15. Upgrades to higher versions are performed in steps. For example, for PostgreSQL, the upgrade sequence from version 13 to 15 is: 13 → 14 → 15.

Warning

You can upgrade to version 17 only using Yandex Data Transfer. To do so, create a cluster with the new version and transfer data to it from the cluster you want to upgrade.

In single-host clusters, the only master host is brought out of its running state for upgrades. During an upgrade, these clusters will be unavailable for reading and writing.

In multi-host clusters, upgrades follow the procedure below:

  1. The master is unavailable during upgrades. During this time, the replicas continue running in read-only mode. No failover occurs. After an upgrade, the master is not returned to a running state until all the replicated hosts are upgraded. It is temporarily unavailable even for reading.

  2. The replicas are sequentially made unavailable and upgraded. The replicas are queued randomly. Following an upgrade, the replicas are returned to a running state in read-only mode.

    A two-host cluster is unavailable while its replica is upgrading. In a cluster of three or more hosts, at least one replica will be available for reading.

  3. The master returns to a running state.

To learn more about updates within a single version and host maintenance, see Maintenance.

Before a version upgrade

Make sure this does not affect your applications:

  1. See PostgreSQL changelog for how upgrades may affect your applications or installed extensions.
  2. Try a version upgrade on a test cluster. You can deploy it from a backup of the main cluster.
  3. Create a backup of the main cluster directly before the version upgrade.

Upgrading a cluster

Alert

  • Once your DBMS is upgraded, you cannot roll a cluster back to the previous version.
  • The success of a PostgreSQL version upgrade depends on multiple factors, including cluster settings and data stored in databases. We recommend that you begin by upgrading a test cluster that has the same data and settings.

Upgrading a cluster to PostgreSQL 17

  1. Create a cluster with PostgreSQL 17.
  2. Use Data Transfer to transfer data to it from the cluster you want to upgrade.

Upgrading a cluster to PostgreSQL 16 or lower

Management console
CLI
Terraform
REST API
gRPC API
  1. Navigate to the folder dashboard and select Managed Service for PostgreSQL.
  2. Select the cluster you need from the list and click Edit.
  3. In the Version field, select a new version number.
  4. Click Save changes.

If you do not have the Yandex Cloud (CLI) command line interface yet, install and initialize it.

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

To upgrade a cluster to PostgreSQL 15 or lower:

  1. Get a list of your PostgreSQL clusters using this command:

    yc managed-postgresql cluster list
    
  2. Get information about the cluster you need and check the PostgreSQL version in the config.version parameter:

    yc managed-postgresql cluster get <cluster_name_or_ID>
    
  3. Run the PostgreSQL upgrade:

    yc managed-postgresql cluster update <cluster_name_or_ID> \
       --postgresql-version <new_version_number>
    
  1. Open the current Terraform configuration file that defines your infrastructure.

    For more information about creating this file, see Creating clusters.

    For a complete list of available Managed Service for PostgreSQL cluster configuration fields, see the Terraform provider documentation.

  2. In the cluster_config section of the required Managed Service for PostgreSQL cluster, add the version field or edit the existing one:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      cluster_config {
        version = "<PostgreSQL_version>"
      }
    }
    
  3. Make sure the settings are correct.

    1. In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.

    2. Run this command:

      terraform validate
      

      Terraform will show any errors found in your configuration files.

  4. Confirm updating the resources.

    1. Run this command to view the planned changes:

      terraform plan
      

      If you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.

    2. If everything looks correct, apply the changes:

      1. Run this command:

        terraform apply
        
      2. Confirm updating the resources.

      3. Wait for the operation to complete.

    Time limits

    A Terraform provider sets the timeout for Managed Service for PostgreSQL cluster operations:

    • Creating a cluster, including restoring from a backup: 30 minutes.
    • Editing a cluster: 60 minutes.
    • Deleting a cluster: 15 minutes.

    Operations exceeding the set timeout are interrupted.

    How do I change these limits?

    Add the timeouts block to the cluster description, for example:

    resource "yandex_mdb_postgresql_cluster" "<cluster_name>" {
      ...
      timeouts {
        create = "1h30m" # 1 hour 30 minutes
        update = "2h"    # 2 hours
        delete = "30m"   # 30 minutes
      }
    }
    
  1. Get an IAM token for API authentication and put it into the environment variable:

    export IAM_TOKEN="<IAM_token>"
    
  2. Use the Cluster.Update method and send the following request, e.g., via cURL:

    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" \
      --header "Content-Type: application/json" \
      --url 'https://mdb.api.cloud.yandex.net/managed-postgresql/v1/clusters/<cluster_ID>' \
      --data '{
                "updateMask": "configSpec.version",
                "configSpec": {
                  "version": "<PostgreSQL_version>"
                }
              }'
    

    Where:

    • updateMask: List of parameters to update as a single string, separated by commas.

      In this case, only one parameter is provided.

    • configSpec.version: New PostgreSQL version.

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

  3. View the server response to make sure the request was successful.

  1. Get an IAM token for API authentication and put it into the 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 the repository contents are stored in the ~/cloudapi/ directory.

  3. Use the ClusterService.Update call and send the following request, e.g., via gRPCurl:

    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/postgresql/v1/cluster_service.proto \
      -rpc-header "Authorization: Bearer $IAM_TOKEN" \
      -d '{
            "cluster_id": "<cluster_ID>",
            "update_mask": {
              "paths": [
                "config_spec.version"
              ]
            },
            "config_spec": {
              "version": "<PostgreSQL_version>"
            }
          }' \
      mdb.api.cloud.yandex.net:443 \
      yandex.cloud.mdb.postgresql.v1.ClusterService.Update
    

    Where:

    • update_mask: List of parameters to update as an array of paths[] strings.

      Only one parameter is provided in this case.

    • config_spec.version: New PostgreSQL version.

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

  4. View the server response to make sure the request was successful.

As soon as you run the upgrade, the cluster status will change to UPDATING. Wait for the operation to complete and then check the cluster version.

Cluster upgrade time depends on the database size.

Tip

Contact support if you have issues upgrading to version 16.

Examples

Let's assume you need to upgrade a cluster from version 14 to version 15.

CLI
  1. To get a list of clusters and find out their IDs and names, run this command:

    yc managed-postgresql cluster list
    
    +----------------------+---------------+---------------------+--------+---------+
    |          ID          |     NAME      |     CREATED AT      | HEALTH | STATUS  |
    +----------------------+---------------+---------------------+--------+---------+
    | c9q8p8j2gaih******** |   postgre406  | 2021-10-23 12:44:17 | ALIVE  | RUNNING |
    +----------------------+---------------+---------------------+--------+---------+
    
  2. To get information about a cluster named postgre406, run the following command:

    yc managed-postgresql cluster get postgre406
    
      id: c9q8p8j2gaih********
      ...
      config:
        version: "14"
        ...
    
  3. To upgrade the postgre406 cluster to version 15, run this command:

    yc managed-postgresql cluster update postgre406 --postgresql-version 15
    

Was the article helpful?

Previous
Maintenance
Next
Deleting a cluster
© 2025 Direct Cursus Technology L.L.C.