Forum Discussion
Power BI DirectQuery to AWS RDS PostgreSQL via SSH Tunnel – SSL Certificate Validation Error
- 1 year ago
KalpeshClearDu
This is a known and painfully tricky issue when trying to use DirectQuery over an SSH tunnel with SSL-enabled PostgreSQL (especially via AWS RDS). You’ve done almost everything right, and it’s clear this isn’t just a standard connectivity problem — it’s certificate validation inside Power BI’s DirectQuery engine, which behaves differently from Import or tools like pgAdmin.Option 1: Use
Server Compatibility Modein connection stringPower BI allows advanced parameters — try tweaking the SSL behavior directly:
-
When connecting in Power BI, choose DirectQuery, then select Advanced options.
In Additional settings, add:
Trust Server Certificate=true;
Ssl Mode=Require;Option 2: Modify the hosts file + use actual RDS endpoint
You can trick Power BI into thinking it's talking to the RDS endpoint:
-
Open your local
hostsfile (as admin):C:\Windows\System32\drivers\etc\hosts
Add a line like:
127.0.0.1 your-rds-endpoint.rds.amazonaws.com
Then connect in Power BI using:
your-rds-endpoint.rds.amazonaws.comThis matches the SSL certificate’s hostname, even though the SSH tunnel is to
localhost.⚠️ Be sure that your tunnel is forwarding to
localhost:5432in this case.Option 3: Use a Power BI Gateway (for scheduled refresh, not desktop)
If your end goal is Power BI Service (not just Desktop), you'd typically need to:
-
Configure the On-premises data gateway to use ODBC + Import (DirectQuery to private RDS is not fully supported out-of-the-box via SSH tunnels)
-
Or host a custom service on EC2/VPN that routes securely
But since you're focused on Desktop testing, this doesn’t help you immediately.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
-
KalpeshClearDu
This is a known and painfully tricky issue when trying to use DirectQuery over an SSH tunnel with SSL-enabled PostgreSQL (especially via AWS RDS). You’ve done almost everything right, and it’s clear this isn’t just a standard connectivity problem — it’s certificate validation inside Power BI’s DirectQuery engine, which behaves differently from Import or tools like pgAdmin.
Option 1: Use Server Compatibility Mode in connection string
Power BI allows advanced parameters — try tweaking the SSL behavior directly:
-
When connecting in Power BI, choose DirectQuery, then select Advanced options.
In Additional settings, add:
Trust Server Certificate=true;
Ssl Mode=Require;
Option 2: Modify the hosts file + use actual RDS endpoint
You can trick Power BI into thinking it's talking to the RDS endpoint:
-
Open your local
hostsfile (as admin):C:\Windows\System32\drivers\etc\hosts
Add a line like:
127.0.0.1 your-rds-endpoint.rds.amazonaws.com
Then connect in Power BI using:
your-rds-endpoint.rds.amazonaws.com
This matches the SSL certificate’s hostname, even though the SSH tunnel is to localhost.
⚠️ Be sure that your tunnel is forwarding to localhost:5432 in this case.
Option 3: Use a Power BI Gateway (for scheduled refresh, not desktop)
If your end goal is Power BI Service (not just Desktop), you'd typically need to:
-
Configure the On-premises data gateway to use ODBC + Import (DirectQuery to private RDS is not fully supported out-of-the-box via SSH tunnels)
-
Or host a custom service on EC2/VPN that routes securely
But since you're focused on Desktop testing, this doesn’t help you immediately.
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!
Thanks For sharing you valuable solution. After 10 Days duration of solving this issue,option 2 that you have provided could solve my problem. Thank you Bro Thank you so much!