Open an SSH tunnel to a remote database

Bash

Forwards a local port through a bastion so a client can connect as if the database were local.

ssh -N -L 5433:db.internal:5432 bastion.example.com

# Then, in another shell:
psql -h localhost -p 5433 -U app mydb

More in Networking

Random picks