For AI agents: the complete documentation index is available at https://docs.ovhcloud.com/pl/llms.txt, the full documentation bundle is available at https://docs.ovhcloud.com/pl/llms-full.txt, and this page is available as Markdown at https://docs.ovhcloud.com/pl/guides/public-cloud/databases/postgresql-prepare-for-incoming-connections.md.
Przejdź do treści

Configure incoming connections of a Public Cloud Databases for PostgreSQL service

Pokaż jako Markdown

Find out how to configure your PostgreSQL instance to accept incoming connections

Objective

Public Cloud Databases allow you to focus on building and deploying cloud applications while OVHcloud takes care of the database infrastructure and maintenance in operational conditions.

This guide explains how to configure your PostgreSQL instance to accept incoming connections.

Requirements

  • A Public Cloud project in your OVHcloud account
  • A PostgreSQL database running on your OVHcloud Public Cloud Databases (this guide can help you to meet this requirement)

OVHcloud Console Access

  • Direct link:
  • Navigation path: Public Cloud > Select your project > Databases

Instructions

Configure your PostgreSQL instance to accept incoming connections

Before making a connection, we need to verify that our PostgreSQL instance is correctly configured.

In the left-hand menu of your Public Cloud project, click PostgreSQL under Databases, then click the name of your PostgreSQL service.

Step 1: Verify your user roles and password

Select the Users tab. Verify that you have a user with sufficient rights and a configured password. If you don't remember the user's password, you can either create a new user or regenerate the password of an existing user. Be careful! By doing so you will need to update all the places where you already use this user/password pair.

This first user avnadmin comes with the following privileges:

  LOGIN
  NOSUPERUSER
  INHERIT
  CREATEDB
  CREATEROLE
  REPLICATION

We rely on official PostgreSQL roles and privileges. You can manage them yourself via CLI or code. So far, user grants and privileges management are not supported via the OVHcloud Console or the OVHcloud API.

See the Manage users, roles and privileges guide for the scope of the replication privilege, the default behaviour of a new user and the usual GRANT commands. The official PostgreSQL documentation describes all available roles.

To reset the avnadmin password, click on the ... button on the row of the user, then on Reset password.

To create a new user, click on Add a user, fill in the form in the Add a user panel, then click on Create.

Once created or updated, the user must have the READY status in the OVHcloud Console.

Warning

Creating a user does not give it access to your data. The user can connect to the database, but has no read or write privileges on your tables until you grant them in SQL.

Step 2: Authorise incoming connections from the PostgreSQL client

By default, a Public Cloud Databases service does not accept any connection from the outside world. This helps prevent intrusive connection attempts.

Warning

As long as no IP address is authorised, your service is unreachable, even though it appears as available in the OVHcloud Console: connection attempts fail, usually with a timeout and no explicit error message on the client side.

Select the Configuration tab, then locate the IP restrictions section.

Click Add, enter an IP address or a CIDR block in the IP block (CIDR) field and a description to identify its origin, then click Save. In our example, we enter 203.0.113.10/32.

Two shortcuts are available next to the add button:

  • Add my current IP: adds the public IP address from which you are browsing the OVHcloud Console. Convenient for a development workstation, provided your address is static.
  • Add OVHcloud Data Platform: adds the addresses required for OVHcloud Data Platform services to reach your database.
Warning

You can enter 0.0.0.0/0 to allow connections from any address. Your service then becomes reachable from the entire Internet, and only the username/password pair protects your data. Reserve this for tests, and prefer restricted CIDR blocks or the vRack private network for production environments.

Info

A dynamic IP address changes periodically: if your workstation or outbound gateway does not have a static address, your connections will stop working without any change on your side. In that case, authorise your provider's CIDR block, or use an egress point with a static address.

Collect required information

Select the Overview tab to find the connection details in the Connection details card: host, port, protocol, connection URI and the CA certificate of the service (Download (.pem)).

Select the Databases tab to get the database name.

Select the Users tab to get the username.

Go further

Connect using the CLI

Secure the TLS connection

Manage users, roles and privileges

Visit the Github examples repository to find how to connect to your database with several languages.

Visit our dedicated Discord channel: https://discord.gg/ovhcloud. Ask questions, provide feedback and interact directly with the team that builds our databases services.

For training or technical assistance implementing our solutions, contact your sales representative or visit our Professional Services page to request a quote and have your project analysed by our experts.

Join our community of users.

Czy ta strona była pomocna?