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
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex DataLens
    • Overview
    • Caching
    • Combining data
      • Creating a ClickHouse® connection
      • Creating a PostgreSQL connection
      • Creating a MySQL® connection
      • Creating a YDB connection
      • Creating a Greenplum® connection
      • Creating a SQL Server connection
      • Creating an Oracle Database connection
      • Creating a Prometheus connection
      • Creating a Snowflake connection
  • Audit Trails events
  1. Connections
  2. Databases
  3. Creating a PostgreSQL connection

Creating a PostgreSQL connection

Written by
Yandex Cloud
Updated at March 31, 2025

Warning

Yandex Cloud holds no responsibility for configuring a remote connection on an external database server side. When connecting an external database which is not a Yandex Cloud resource:

  • When using your own SSL certificate, make sure it matches the one on the database side.

  • Grant database access to the following DataLens IP ranges (/ is followed by subnet mask length):

    ipv4
    ipv6
    • 178.154.242.176/28
    • 178.154.242.192/28
    • 178.154.242.208/28
    • 178.154.242.128/28
    • 178.154.242.144/28
    • 178.154.242.160/28
    • 130.193.60.0/28
    • 2a02:6b8:c03:500:0:f83d:a987:0/112
    • 2a02:6b8:c02:900:0:f83d:a987:0/112
    • 2a02:6b8:c0e:500:0:f83d:a987:0/112
    • 2a02:6b8:c41:1300:0:f83d:a987:0/112

To create a PostgreSQL connection:

  1. Open the page for creating a new connection.

  2. Under Databases, select the PostgreSQL connection.

    screen01

  3. Select the connection type:

    Select in organization
    Specify manually
    Connection Manager

    Select a managed DB in the current Yandex Cloud organization and specify the internal network connection parameters for it:

    • Cloud and folder. Select the folder the cluster is located in.

    • Cluster. Specify a cluster from the list of available PostgreSQL clusters. Cluster settings must have the DataLens access option enabled. If you do not have an available cluster, click Create new.

      Note

      The list shows the following clusters:

      • With permissions for the user who creates the connection.
      • Created in the same organization as the DataLens instance.
    • Host type. Select a host type:

      • Regular (default): Allows you to select regular hosts to connect to.
      • Special FQDNs: Allows you to select special FQDNs for connection, which always point to the current master host or to its closest replica in the PostgreSQL cluster.
    • Hostname. Select the host name from the list of hosts available in the PostgreSQL cluster. You can select multiple hosts. If you are unable to connect to the first host, DataLens will select the next one from the list.

    • Port. Specify the PostgreSQL connection port. In Yandex Cloud, the default port is 6432.

    • Path to database. Specify the name of the database to connect to.

    • Username. Specify the username for the PostgreSQL connection.

    • Password. Enter the password for the user.

    • Cache TTL in seconds. Specify the cache time-to-live or leave the default value. The recommended value is 300 seconds (5 minutes).

    • Raw SQL level. Enables you to use an ad-hoc SQL query to generate a dataset.

      Click Check connection to make sure the parameters are correct.

    screen02

    Manually specify the parameters of an external database to connect to via a public network:

    • Hostname. Specify the path to a master host or a PostgreSQL master host IP address. You can specify multiple hosts in a comma-separated list. If you are unable to connect to the first host, DataLens will select the next one from the list.
    • Port. Specify the PostgreSQL connection port. In Yandex Cloud, the default port is 6432.
    • Path to database Specify the name of the database to connect to.
    • Username. Specify the username for the PostgreSQL connection.
    • Password. Enter the password for the user.
    • Cache TTL in seconds. Specify the cache time-to-live or leave the default value. The recommended value is 300 seconds (5 minutes).
    • Raw SQL level. Enables you to use an ad-hoc SQL query to generate a dataset.

    Click Check connection to make sure the parameters are correct.

    screen03

    Note

    To use a Connection Manager connection in DataLens, the user must have the connection-manager.user role for this connection.

    Select a connection to a PostgreSQL managed database cluster created in Yandex Connection Manager:

    • Cloud and folder. Select the folder where the connection to the cluster was created.
    • Connection ID. Select an available connection in Connection Manager or create a new one.
    • Host. Select a host from the list of available hosts in the PostgreSQL cluster.
    • Port. It is set automatically depending on the selected host.
    • Database. Specify the name of the database to connect.
    • Username. It is set automatically from the selected connection data.
    • Cache TTL in seconds. Specify the cache time-to-live or leave the default value. The recommended value is 300 seconds (5 minutes).
    • Raw SQL level. Enables you to use an ad-hoc SQL query to generate a dataset.

    screen04

  4. Click Create connection.

  5. In the window that opens:

    1. Select a workbook to save your connection to or create a new one. If using legacy folder navigation, select a folder to save the connection to.

    2. Enter the connection name.

    3. Click Create.

    screen05

Additional settingsAdditional settings

You can specify additional connection settings in the Advanced connection settings section:

  • Setting collate in a query: To explicitly define a collation for DB queries, select a mode:

    • Auto: Default setting is used, DataLens decides whether to enable the en_US locale.
    • On: DataLens setting is used, the en_US locale is specified for individual expressions in a query. This makes the server use the appropriate sorting logic, regardless of the server settings and specific tables. Use the DataLens setting if the DB locale is incompatible with DataLens performance. For more information on the locale and LC_COLLATE, see Creating a cluster.
    • Off: Default setting is used, DataLens only uses the existing parameters of the DB locale.
  • TLS: Indicates whether TLS is required. When the option is enabled, the sslmode parameter is set to required. When the option is disabled, the parameter is set to prefer.

  • CA Certificate: To upload a certificate, click Attach file and specify the certificate file. When the certificate is uploaded, the field shows the file name.

  • Disable data export: When this option is enabled, the export data button will be hidden in the charts based on this connection. However, you will still be able to copy chart data and take screenshots.

screen07

Was the article helpful?

Previous
Creating a ClickHouse® connection
Next
Creating a MySQL® connection
Yandex project
© 2025 Yandex.Cloud LLC