How an SSH tunnel lets Metabase reach a private warehouse
When a data warehouse sits behind a firewall and direct connections are either blocked or forbidden by security policy, Metabase can still connect through an SSH tunnel to a bastion host. The bastion is a host that both your network team and Metabase can reach: Metabase opens an encrypted SSH session to it, and the session forwards the database traffic on to the warehouse. The tunnel solves reachability. It does not change who may query what, does not replace database-side permissions, and does not remove the need to confirm that the bastion itself is tightly controlled, because anyone who can use that tunnel path can reach whatever the bastion can reach.
The connection settings describe two different network views, and mixing them up is the most common setup error. The warehouse host and port must be the address and port as seen from inside the network, which may be a private name or address that the Metabase server cannot resolve on its own. The SSH settings are the bastion's external host and SSH port, usually 22, as seen from the Metabase server. Confirm both values with the team that runs the network before you enter them, and test from the Metabase host itself, because a route that works from a workstation may not exist from the server running Metabase.
Decide early between password and key authentication for the SSH login. A password is simpler to rotate in a hurry but is easier to leak through configuration files and shared notes. A dedicated key pair, with the private key stored only on the Metabase server and the public key limited to a tunnel account on the bastion, is the usual choice for a self-hosted deployment. Ask the bastion owners whether that account can be restricted to port forwarding only and whether its activity is logged. If the traffic path must be private end to end, a network-level connection such as a VPN or peered private network may be the better design. Metabase Cloud does not support VPN connections to databases and uses SSH tunneling for private networks, so the choice belongs to your own deployment.
What you need before configuring the tunnel
A bastion tunnel only works when several pieces line up before anyone opens the Metabase admin panel. Collect these inputs, confirm each network path, and prove the warehouse works from the bastion first, so that a failed connection can be traced to one layer.
Warehouse host and port as the bastion sees it
Record the warehouse address exactly as the bastion resolves it, which may be a private IP or an internal DNS name that differs from the public-facing name. Confirm the database port the warehouse listens on. A name that resolves on your laptop but not on the bastion is the most common cause of a failed tunnel. Ask the network team to confirm both values in writing.
Bastion external host and SSH port
Collect the bastion's address as Metabase will reach it, along with its SSH port. Port 22 is the usual default, but many organizations move SSH to another port, so confirm the value rather than assume it. Check that the bastion's SSH service accepts TCP connections from the Metabase host's outbound address.
SSH user and authentication method
Choose a dedicated SSH account on the bastion for Metabase, with no shell rights beyond what forwarding needs. Decide between password and key authentication before configuring anything, since the fields Metabase asks for differ. Key authentication keeps secrets out of login prompts, but the private key must then be stored and rotated on the Metabase host, so plan who holds that key and how it is replaced.
Network path from Metabase to the bastion
Confirm that the host running Metabase can open a TCP connection to the bastion's SSH port through every firewall and security group in between. Test from the same host and the same network segment that runs Metabase, not from an administrator workstation. A container network or a proxy can block the path even when the bastion is healthy.
Bastion route to the warehouse
Verify that the bastion can reach the warehouse host and port on the network, and that no policy blocks the traffic between them. Run a basic connection test from the bastion itself. If this path is missing, the tunnel will open but every query will fail, which makes the error look like a Metabase problem.
Warehouse driver and credentials verified from the bastion
Before adding the tunnel, connect to the warehouse from the bastion with the same database user, password or certificate, and driver version that Metabase will use. This separates credential and permission errors from tunnel errors. Record which database user Metabase uses, because its read-only grants determine what the dashboards can see.
Exact field list in the official docs
The fields, their labels and their behavior depend on your Metabase version and on whether you use password or key authentication. Read the official SSH tunneling page for the current list, and confirm each setting in the admin panel of the version you run before recording values in a change ticket. Do not copy field names from older blog posts or forum answers.
SSH tunneling docsConfiguring the SSH tunnel in Metabase step by step
This sequence takes a self-hosted Metabase from a blank database form to a working connection that reaches a warehouse behind a bastion host. Each step ends with a check so you know whether to continue or troubleshoot.
Open the database settings in the admin panel
Sign in to Metabase as an administrator, open the admin settings, and go to the Databases section. Select Add database, then choose the warehouse type your team uses. Confirm the driver is an official one for your database, since community drivers may not offer the same tunnel options. The check is that the database form opens with its connection fields visible, including the SSH tunnel option. Exact menu labels can change between releases, so confirm them in the SSH tunneling documentation for your running version.
Enable the SSH tunnel option
Find the SSH tunnel toggle on the connection form and switch it on. The form expands to show fields for the bastion details and authentication. Leave the direct host and port fields for later, since they now describe the warehouse as seen from the bastion, not from the Metabase server. The check is that the SSH fields appear beneath the database fields. If the toggle is missing, the driver or Metabase version may not support tunneling for this database, so confirm before you go further.
Enter the bastion host and SSH port
Enter the bastion's address as the Metabase server can reach it, which is usually an external hostname or IP address, and the SSH port. The port is usually 22 unless your security team has moved it. Ask the network team for the exact values and confirm that the Metabase host can open an outbound connection to this address and port through its firewall rules. The check is that the fields accept the values without validation errors. Do not use the warehouse's internal address here.
Enter the SSH username
Enter the account name that Metabase will use to log in to the bastion. Ask the bastion administrator for a dedicated account that only exists for this tunnel, with no shell access beyond what forwarding requires. Keeping one account per Metabase instance makes it easier to revoke access and to see tunnel activity in the bastion logs. The check is that the username field is filled in and matches the account the bastion administrator created.
Add the password or private key
Choose the authentication method the bastion accepts. Key-based authentication is generally preferred, so paste the private key that matches the public key installed for the tunnel account, and keep its passphrase policy consistent with your security standards. If you use a password, store it only in Metabase's encrypted settings and rotate it on your own schedule. Confirm the key format with the bastion administrator, because mismatched key formats are a common cause of failed logins. The check is that the chosen method is set and no field shows a missing-credential warning.
Set the warehouse host and port from inside the network
Enter the warehouse hostname or private IP address and its database port exactly as the bastion resolves them, not as an outside client would. Ask the platform or data team to confirm the internal name, since a name that resolves only on the public internet will fail through the tunnel. Also confirm the database name and the read-only user Metabase should use. The check is that these values match what the bastion can reach, which you can verify with a quick test from the bastion itself before saving.
Save and run the connection test
Select Save, which triggers Metabase to test the connection through the tunnel. A success message means the bastion accepted the login, the forward opened, and the warehouse accepted the database credentials. If it fails, read the error and check the bastion logs, the firewall path, the key or password, and the internal host name in that order. The check is a successful connection test, followed by a sync that lists the schemas and tables you expect.
Confirm the sync and run a test query
After the sync completes, open the table list and confirm that the expected schemas and tables appear. Then run a simple query, such as a row count on a small table, in the query builder or SQL editor as an ordinary user with the intended group permissions. The check is that the query returns rows. If the tables appear but queries fail or return nothing, review the database user's grants rather than the tunnel, because the tunnel has already been proven by the sync.
Key versus password authentication for the bastion
With key-based authentication, Metabase uses a private SSH key to sign in to the bastion, and the bastion holds the matching public key in the bastion account's authorized keys. In the database connection settings you supply the bastion host, the SSH port (usually 22), the bastion username and the private key, so no bastion password is stored in Metabase. The key is usually easier to scope than a password because it can be restricted to one account and one purpose on the bastion.
- Who manages it: The security or platform team generates a dedicated key pair for Metabase, and the private key is stored in Metabase's configuration, not in a shared document.
- Rotation: Rotate by adding a new public key to the bastion, updating the database connection in Metabase, then removing the old public key.
- Revocation: Removing the public key from the bastion cuts off access immediately, without changing any password used by other systems.
- Compromise of the Metabase server: An attacker who reads the private key can open tunnels as long as the key is valid, so the bastion restrictions described in the next tab matter most here.
- Passphrase: Confirm with your team whether the key is protected by a passphrase and whether your policy requires one, since Metabase's handling of protected keys should be checked in your version.
Before you rely on this method, confirm with your security policy owner that key-based access to the bastion is permitted and how keys must be generated and stored.
With password-based authentication, Metabase stores the bastion account password in the database connection and uses it to sign in before opening the tunnel. Setup is simpler because no key pair has to be generated or installed, but the password becomes a shared secret that must be stored, rotated and protected like any other credential. Some bastions or security policies disable password logins entirely, so check this before you design around it.
- Who manages it: The bastion administrator sets the password, and the Metabase administrator enters it in the connection settings, which creates two places where the value lives.
- Rotation: Changing the password requires a coordinated update on the bastion and in Metabase, and a missed step causes the connection to fail.
- Revocation: Disabling the account or changing the password stops access, but any copy kept in backups or runbooks must also be cleaned up.
- Compromise of the Metabase server: A stolen password can be reused against the bastion wherever else it is accepted, so the exposure extends beyond this one tunnel.
- Brute force: Password logins on a bastion are more exposed to guessing than key logins, so confirm how the bastion limits failed attempts.
Before you choose this method, confirm with your security policy owner that password authentication is allowed on the bastion and that the password meets your storage and rotation requirements.
Whichever method you choose, the bastion account should be able to do one thing: forward traffic to the warehouse host and port. Without that limit, a compromised Metabase server could use the account for interactive shell access or to reach other internal systems. The exact controls depend on your bastion software, so confirm them with your platform team against that product's documentation.
- No interactive shell: Configure the account so it cannot run commands or open a login session, and allow only port forwarding.
- Single destination: Restrict forwarding to the warehouse host and port, using the restriction options your SSH server supports for the account's key or session.
- No agent or X11 forwarding: Disable forwarding features the tunnel does not need.
- Dedicated account: Use an account that exists only for Metabase, so its activity is easy to separate in the bastion logs.
- Logging: Make sure connection attempts and tunnel sessions are logged on the bastion and forwarded to your central log system.
After the restrictions are in place, test them by confirming that the tunnel works, and that the account cannot open a shell or reach any other host or port.
The practical choice is usually driven by your security policy rather than by setup effort. Key-based authentication generally gives clearer ownership, simpler revocation and less reusable exposure, while password-based authentication may be the only option a bastion allows. Decide which method your policy permits, record who owns the credential, and set a review date for it.
- Policy first: Ask your security policy owner which methods are allowed on bastions that serve production data.
- Ownership: Name the team that creates, rotates and revokes the credential, and confirm that person can act without the Metabase administrator.
- Storage: Confirm how Metabase stores the credential in your deployment, and who can view it through the admin interface.
- Rotation schedule: Agree how often the credential changes, and what the runbook is for an emergency change.
- Alternative designs: If neither method meets policy, the private network path described elsewhere on this page may be the better design.
Before go-live, confirm the chosen method in writing with the team that owns the bastion and the team that owns the warehouse.
How the connection flows from Metabase to the warehouse
The flow starts at the Metabase server, which opens an SSH connection to the bastion's external host and SSH port. The bastion then forwards traffic to the warehouse host and port as seen inside the private network, so the warehouse never needs a public address. Check that each hop uses its own credential, that the bastion's public side is the only path crossing the trust boundary, and that the warehouse host and port are the ones reachable from the bastion's private segment.
Metabase reaches the warehouse only through the bastion's SSH hop.
When a private network path is the better design
A private network path is usually the better design when your team controls both the Metabase host and the network between it and the warehouse, because it removes the SSH entry point entirely. An SSH tunnel adds a hop, an SSH service that must be patched and monitored, and a credential that has to be issued, rotated and revoked. Options such as VPC or VNet peering, a private endpoint or private link offered by the cloud provider, a VPN from the Metabase network to the data center, or running Metabase inside the same network segment as the database each keep the database reachable without opening a bastion to the internet or to a wider subnet. Metabase's SSH tunneling documentation describes the tunnel as the answer for cases where a direct connection is impossible or forbidden by policy, so the first question is whether either condition really applies.
Before choosing the tunnel, ask the network team what routing already exists. Confirm whether the Metabase host can reach the warehouse port directly, whether peering or a private endpoint is already provisioned for that database, whether a site-to-site VPN covers the subnet, and whether a firewall rule change is a shorter path than a new bastion. Also confirm who owns the bastion, how it is hardened and logged, and whether your security policy accepts an inbound SSH service at all. Metabase Cloud does not support VPN connections to databases and uses SSH tunneling for private networks, so teams used to Metabase Cloud may assume a tunnel is the only option. That constraint does not apply to a self-hosted instance, where your team decides the network design. Document the decision with the network and security owners so the choice is traceable at review time.
Hardening the bastion path for a regulated warehouse
An SSH tunnel gives Metabase a route to a warehouse that has no public address, so the bastion becomes a security boundary in its own right. The cards below cover the controls that keep that route narrow, auditable and limited to read access, from the bastion account to the warehouse user.
Dedicated bastion account with fixed forwarding
Create a bastion account used only by Metabase, with no interactive shell and no access to other hosts. Limit it to forwarding traffic to the warehouse host and port that Metabase needs, so a compromised Metabase server cannot pivot to other internal systems. Ask your network team to confirm that the account cannot reach anything beyond that single destination.
Key-based authentication with protected keys
Use a dedicated SSH key pair for the tunnel rather than a shared password, and store the private key where only the Metabase service account can read it. Set a passphrase or keep the key in a secrets manager, and rotate it on a schedule your security team sets. Confirm how Metabase reads the key on your deployment before you finalize file permissions.
SSH tunnel docsSource address restriction on the bastion
Allow SSH connections to the bastion only from the address of the Metabase server, enforced in the bastion's firewall or security group as well as in the SSH configuration. A bastion reachable from anywhere turns a stolen key into an open door. Recheck the rule whenever the Metabase host moves or scales out.
Logging and monitoring SSH sessions
Record authentication attempts, accepted keys and forwarding sessions on the bastion, and forward those logs to a central system your security team monitors. Alert on failed logins, logins outside expected hours and new source addresses. Confirm with your team how long these logs are retained so that an access review can reach back far enough.
Read-only warehouse user
The tunnel only moves packets, so the warehouse user decides what Metabase can change. Create a database user with read-only privileges on the schemas Metabase needs and nothing else. Treat the bastion as a transport layer and the database grants as the access control.
Credentials and certificates handled separately
The warehouse password and SSL certificate validation are configured apart from the tunnel, and they need their own review. A correct tunnel does not prove the database connection is authenticated or encrypted end to end. Plan those settings as a separate checklist item before go-live.
Which setting maps to which system
This table maps each SSH tunnel field in Metabase to the system it refers to, so you can see which values come from the warehouse network, which come from the bastion, and which credentials belong to the database. Read it before you fill in the connection form, because the warehouse host is resolved from the bastion's side of the network, not from Metabase's. The main takeaway is that the SSH tunnel only gets Metabase to the database port, and the database user still authenticates separately.
| Setting | Points to | Where the value comes from |
|---|---|---|
| Warehouse host and port | The database server, as the bastion sees it inside the network | Your network team or the database owner; often a private DNS name or IP such as <warehouse-private-host>:<db-port> |
| Bastion external host | The SSH jump host that Metabase connects to from outside the private network | Your platform team; use a placeholder such as <bastion-host> and confirm it is reachable from the Metabase server |
| Bastion SSH port | The port the bastion listens on for SSH, usually 22 | Your bastion configuration; confirm the value with the team that runs the host |
| SSH user | The account Metabase logs in as on the bastion | Account created for the tunnel only, such as <tunnel-user>; it should not be a personal login |
| SSH credential store | Where the bastion password or private key is held for Metabase | Password or key entered in the Metabase database settings; confirm who can read the stored secret and where the Metabase server keeps it |
| Warehouse database user | Authentication to the database itself, after the tunnel is open | Database role created by the database owner, such as <metabase-db-user>; the tunnel does not replace this login |
| Warehouse database password or auth method | The credential the database checks, separate from the SSH credential | Database administrator; confirm which authentication methods the warehouse accepts for that user |
Questions teams ask before configuring an SSH tunnel
Can our own team configure an SSH tunnel to a private database for Metabase?
Yes, if your team already manages bastion hosts, SSH keys and firewall rules. Metabase's SSH tunneling settings are short: the warehouse host and port as seen from inside the network, the bastion's external host and SSH port (usually 22), and either a password or a key. The harder part is the network work around those fields: confirming the bastion can reach the warehouse, opening the right outbound and inbound rules, and deciding who owns the key. Check the field list and the supported databases in Metabase's SSH tunneling documentation before you start, and confirm with Metabase which of your warehouses support the tunnel option in your version.
What makes an SSH tunnel project take more effort?
Effort rises with the number of network paths, the number of warehouses behind different firewalls, and how many approvals each path needs. Each warehouse usually needs its own tunnel definition, its own bastion access rule and its own review. Key management adds work when keys must be generated, stored, rotated and removed when people leave. Ask your network and security teams to list every warehouse, source network and bastion involved before anyone estimates the work. A written inventory turns an open-ended request into a scope that a partner or internal team can price or plan.
How long does it take to get a tunnel approved and working?
The duration depends mostly on your network change control, not on Metabase's settings. Teams with a fast change process can often finish a single tunnel in a short cycle, while organizations that require security review, firewall change tickets and a maintenance window take longer. Ask your change board how long a firewall rule and a bastion account request normally take, and whether a test environment can be used first. No general duration applies, so plan from your own approval calendar.
What do the network and security teams need to provide?
The network team needs to confirm the warehouse's internal host and port, the route from the bastion to it, and the firewall rules that allow only that traffic. The security team needs to approve the bastion account, the authentication method, the key or password storage location and the logging of bastion sessions. Both teams should agree who can change the tunnel settings in Metabase and how a key is rotated. Confirm with your own policies whether password authentication is allowed at all, since key authentication is usually easier to govern.
Is an SSH tunnel the right design, or should we use a private network path?
An SSH tunnel fits when a direct connection is impossible or forbidden and the warehouse can be reached through one bastion. A private network path, such as peering or a private link between the Metabase network and the warehouse network, is often easier to operate when many users or many warehouses depend on Metabase. Metabase Cloud does not support VPN connections to databases and uses SSH tunneling for private networks, but a self-hosted Metabase runs inside your own network, so you can choose the path. Compare the operating burden of each: tunnel keys and bastion sessions on one side, routing and firewall policy on the other. Confirm the options with your network architects before you commit.
What does a fixed-scope DeployOpen engagement cover for a tunnel setup?
DeployOpen plans, implements, documents and supports self-hosted open-source platforms in your own infrastructure, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing before work starts. For a tunnel setup, that scope would typically be defined from your warehouse and bastion inventory, the Metabase connection configuration, the key handling approach and verification steps agreed with your teams. Ask any partner to state in writing which network changes they will make, which they will only document, and which remain with your team. A quote follows from that written scope.
What should we verify after the tunnel is configured?
Verify that Metabase can sync the schema and run a query against each warehouse through the tunnel, and that the connection fails when the bastion or key is removed. Check that only the intended bastion and warehouse ports are open, that bastion sessions are logged, and that a leaver's key is revoked. Repeat the test after any Metabase upgrade, because the connection configuration and driver behavior can change between releases. Record the checks so your security team can review them later.
How DeployOpen scopes and delivers private database connections
DeployOpen treats an SSH tunnel to a private warehouse as a designed network path, not a quick connection setting. We agree the scope in writing, build the bastion and Metabase settings together, test the path end to end and hand over the configuration with the runbook your team needs to operate it.
How we scope
- Inventory every private database Metabase must reach, with its host, port and owning team.
- Confirm whether a direct connection, an SSH tunnel or a private network path fits your security policy.
- Agree in writing which bastion host, key or password method and access owner the tunnel will use.
How we build
- Configure the tunnel settings in Metabase using the warehouse host and port as seen inside your network.
- Set up bastion access with key-based authentication and restrict which destinations the account can reach.
- Verify the connection from a clean Metabase user, confirming sync and queries work through the tunnel.
How we hand over
- Deliver a written configuration record covering hosts, ports, authentication method and key ownership.
- Document the rotation steps for bastion keys or passwords so credential changes do not break dashboards.
- Provide a runbook for diagnosing tunnel failures, including what to check on the bastion and in Metabase logs.
How we support
- Fixed-scope engagements are agreed in writing before work starts, with deliverables and timelines stated.
- Ongoing support, upgrades and continuous testing of the tunnel path are available as a retainer.
- Ask for a quote that separates the bastion work, the Metabase configuration and any network changes.

