in reply to Connecting to a database in AWS using SSL

Thanks and just an update....

The connection to AWS services requires an SSH Tunnel and a plain connection through it. I just have to use the PEM file and ssh command line to open a session whice enables the tunnel between a local port and the remote port in the server where Postgres runs. The only thing I had to do in my scripts was to change the local port number in the connection string in order to get into the tunnel and, as I supposed, the sslmode was not required.

Well, when I started this thread, I was thinking that there probably existed a module to provide the SSH tunnel without the dummy shell, but now I have to call an external non-perl script to set up the tunnel before trying to connect to the remote database, and deal with an unexpected close of the tunnel.

BTW, psql tool also requires the tunnel to reach AWS postgresql databases.

Replies are listed 'Best First'.
Re^2: Connecting to a database in AWS using SSL
by hippo (Archbishop) on Jun 12, 2025 at 11:41 UTC
    I was thinking that there probably existed a module to provide the SSH tunnel without the dummy shell

    The module Net::OpenSSH will let you manage such tunnels (as well as many other operations besides). Give that a look and see if it will allow you to handle everything from inside your Perl script.


    🦛