Connecting to a PostgreSQL Cluster

Now that you’ve created a cluster, it’s time to connect your application to your new PostgreSQL cluster.  Aside from setting your firewall rules, Instaclustr provides a few examples (customised to your cluster) for the wide selection of client libraries PostgreSQL supports to help you through this process.

After your Cluster has finished provisioning, navigate to your Cluster Details page. All your nodes should be in a Running state with no errors listed. Depending on whether your cluster was provisioned in a Private Network, there will be both public and private (data centre local) IP addresses allocated to cluster nodes. If both are available, they will be listed with their respective nodes on this page.

Note: We suggest that if your application is running within the same data centre as your cluster, you investigate configuring your client to connect to the private addresses. Please refer to your provider’s pricing documentation.

Instaclustr manages the firewall permissions for the nodes in your cluster. Each cluster node only allows connections from one or more trusted IP addresses. You can add one or more trusted IP addresses to the cluster firewall by clicking Firewall Rules from the side bar.

Under the Firewall Rules section, enter any additional IP addresses you wish to trust to the PostgreSQL Allowed Addresses list. If your cluster is running on AWS and clients are connecting using VPC peering, then you may also add one or more AWS security groups to the list. Click Add my Public IP to firewall to add your public IP address to the cluster firewall and then Save to save your changes.

Instaclustr provides connection information and examples on the Connection Info page which can be accessed by clicking Connection Info from the side bar.

The Connection Info page contains a list of your node addresses, authentication credentials to connect to your cluster and a few connection examples for popular clients that PostgreSQL supports.

Please make sure if you are using a multi node postgresql cluster to include all node addresses in your connection configuration to be able to reconnect on primary switchovers.

There are a large number of PostgreSQL client libraries that cover a wide range of languages. Instaclustr provides step-by-step examples for:

  1. Command Line
  2. Java
  3. Python
  4. C++


In the examples, there will be a connection option called target_session_attrs. This option determines whether the session must have certain properties to be acceptable. It’s typically used in combination with multiple host names to select the first acceptable alternative among several hosts. For details on how to use this option and what values can be used, see here.

By Instaclustr Support
Need Support?
Experiencing difficulties on the website or console?
Already have an account?
Need help with your cluster?
Contact Support
Why sign up?
To experience the ease of creating and managing clusters via the Instaclustr Console
Spin up a cluster in minutes