dckr9
dckr9

Reputation: 133

Superset Connect to a private database

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?

Upvotes: 7

Views: 2419

Answers (2)

Jamshid Hashimi
Jamshid Hashimi

Reputation: 7823

This worked for me:

ssh -i /path/key-pair_instance1.pem username_of_instance1@i-0123456789abcdefa -L 9090:ec2-xxx-xx-xxx-x.compute-1.amazonaws.com:3306

Here is the source with further explanation.

Upvotes: 0

anon
anon

Reputation:

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:[email protected]:3336/dbname

Upvotes: 2

Related Questions