Connecting to a database
For each active database, Tonic Ephemeral provides access to the connection details for the database.
The connection information is on the Connection Details tab of the database details panel.
Displaying the connection details
From the Databases page, to display the connection details for the database:
Click the database icon for the database.

Click the options icon for the database, then click Connection Info.

On the Connection Details tab, each field includes a copy icon to allow you to copy the value to the clipboard.

Note that by default, databases on Ephemeral Cloud are publicly accessible. To limit database access to specific IP addresses, you can configure an allowlist. For more information, go to Configuring an allowlist for Ephemeral Cloud database connections.
Connecting through an SSH tunnel (for older databases)
For Ephemeral Cloud databases that were created before version 064, you connect to the database through an SSH tunnel.
For these databases, the connection details include the information for the SSH tunnel.

Creating an SSH tunnel to a database
To create an SSH tunnel to a database from a local machine:
ssh -N -L <localport>:<database-hostname>:<database-port> <bastion-username>@<bastion-host> -p <bastion-port>
For example:
ssh -N -L 9999:svc-bd391f5270d64defb63100cc1bdaa32b:5432 [email protected] -p 9000
In the command:
-N
tells SSH to not open a shell. Ephemeral does not allow shell access.<localport>
is the port the database will be accessible at on your local machine.The other values (
<database-hostname>
,<database-port>
,<bastion-username>
,<bastion-host>
,<bastion-port>
) are available from the Connection Info panel.
If the private key file is not configured in your SSH agent, then you can optionally add -i
to specify the private key file.
ssh -N -L <localport>:<database-hostname>:<database-port> <bastion-username>@<bastion-host> -p <bastion-port> -i <private-key-file>
For example:
ssh -N -L 9999:svc-bd391f5270d64defb63100cc1bdaa32b:5432 [email protected] -p 9000 -i ephemeral-key.pem
Confirming and troubleshooting the SSH tunnel connection
If you are not sure that the connection is successful, or are unable to connect to the database, then here are a couple of troubleshooting steps to check that the tunnel is open and you can connect to the database.
Verifying that the tunnel is open
To verify that the tunnel is open, try to connect in a tool such as telnet or netcat. Test the connection from the same machine that you used when you ran the command to open the tunnel.
For example, to use netcat to try to connect from your local machine:
nc -zv localhost <localPort>
Or for telnet:
telnet localhost <localPort>
If the tool does not return an error, then the tunnel is open.
Verifying that you can connect to the database
After you verify that the tunnel is open, to verify that you can connect to the database, use a terminal client to issue a query against the database.
If the query from the terminal client is successful, but you are unable to connect from your database client, then there might be an issue with your database client.
Last updated
Was this helpful?