I have a database running in a private VPC. The database isn't publicly accessible. Does superset support Connecting to databases via an SSH Tunnel? If so any link to the docs?
Asked
Active
Viewed 1,670 times
2 Answers
2
I couldn't find it in the docs, but with the SSH tunnel you basically need to change the DB host to 127.0.0.1
(not localhost
, since that's a keyword reserved for connection using the MySQL socket), and everything else should be the same.
For example, I tested with a MySQL database that I have running on host.example.com
. I first created a tunnel redirecting my local port 3336 to MySQL's port 3306 (I did that because I already have MySQL running locally on 3306):
ssh -N -L 3336:127.0.0.1:3306 host.example.com
Then I was able to add it to Superset using this SQLAlchemy URI:
mysql://username:password@127.0.0.1:3336/dbname

Beto Dealmeida
- 564
- 3
- 8
-
What is the -N flag for? I don't get it in the usage list when running `$ssh` – aviya.developer Jan 21 '21 at 15:14
-
1On Mac OS: "-N Do not execute a remote command. This is useful for just forwarding ports." – Beto Dealmeida Jan 21 '21 at 16:09
0
This worked for me:
ssh -i /path/key-pair_instance1.pem username_of_instance1@i-0123456789abcdefa -L 9090:ec2-198-51-100-2.compute-1.amazonaws.com:3306
Here is the source with further explanation.

Jamshid Hashimi
- 7,639
- 2
- 28
- 27