Created
July 2, 2022 00:56
-
-
Save miguelmota/0e32f87b32ddb4205dedd37f948c6611 to your computer and use it in GitHub Desktop.
PostgreSQL SSH Tunnel Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host db_tunnel | |
HostName 1.2.3.4 | |
User ubuntu | |
Port 22 | |
RemoteCommand echo 'tunnel open' && cat | |
IdentityFile ~/.ssh/hop/id_rsa | |
IdentitiesOnly yes | |
Localforward 5432 localhost:5432 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# terminal 1 | |
ssh db_tunnel | |
# terminal 2 | |
psql -h localhost -U postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment