Using a PostgreSQL client to connect to your DB cluster - Amazon Aurora

Using a PostgreSQL client to connect to your DB cluster

You can use a PostgreSQL client to connect to Babelfish on the PostgreSQL port.

Using psql to connect to the DB cluster

You can download the platform-specific version of your PostgreSQL client from the PostgreSQL website. Follow the instructions for your platform to install psql.

You can query an Aurora PostgreSQL DB cluster that supports Babelfish with the psql command line client. When connecting, use the PostgreSQL port (by default, port 5432). Typically, you don't need to specify the port number unless you changed it from the default. Use the following command to connect to Babelfish from the psql client:

psql -h bfish-db.cluster-123456789012.aws-region.rds.amazonaws.com -p 5432 -U postgres -d babelfish_db

The parameters are as follows:

  • -h – The host name of the DB cluster (cluster endpoint) that you want to access.

  • -p – The PostgreSQL port number used to connect to your DB instance.

  • -dbabelfish_db

  • -U – The database user account that you want to access. (The example shows the default master username.)

When you run a SQL command on the psql client, you end the command with a semicolon. For example, the following SQL command queries the pg_tables system view to return information about each table in the database.

SELECT * FROM pg_tables;

The psql client also has a set of built-in metacommands. A metacommand is a shortcut that adjusts formatting or provides a shortcut that returns meta-data in an easy-to-use format. For example, the following metacommand returns similar information to the previous SQL command:

\d

Metacommands don't need to be terminated with a semicolon (;).

To exit the psql client, enter \q.

For more information about using the psql client to query an Aurora PostgreSQL cluster, see the PostgreSQL documentation.

Using pgAdmin to connect to the DB cluster

You can use the pgAdmin client to access your data in native PostgreSQL dialect.

To connect to the cluster with the pgAdmin client
  1. Download and install the pgAdmin client from the pgAdmin website.

  2. Open the client and authenticate with pgAdmin.

  3. Open the context (right-click) menu for Servers, and then choose Create, Server.

    
							Adding the server on pgAdmin.
  4. Enter information in the Create - Server dialog box.

    On the Connection tab, add the Aurora PostgreSQL cluster address for Host and the PostgreSQL port number (by default, 5432) for Port. Provide authentication details, and choose Save.

    
							Defining the connection on pgAdmin.

After connecting, you can use pgAdmin functionality to monitor and manage your Aurora PostgreSQL cluster on the PostgreSQL port.


							Monitoring a server with pgAdmin.

To learn more, see the pgAdmin web page.