AWS Self Hosted Redash instance to connect postgres in GCP using cloud sql proxy

Hello Everyone,
Greetings for the day! Hope everyone are doing great here!

I would like to grab a Helping hands with our use case in our project.

We have hosted Redash in EC2 ( AWS ) instance and connected to redshift to pull data for business users to visualize the data. Since our architect direction is to move GCP away from AWS, we started experimenting redash by connecting to one of the Postgres Instance which is running in GCP.

Our setup:

  • Redash is running in one of our EC2 instance as docker container.

  • Postgres instance Hosted in GCP is accessible via cloud sql proxy

My question:

  • How do I connect the cloud sql proxy with redash docker to setup the connection in redash for postgres instance?

What I tried :

Could someone help me out in this question? Thanks a lot in advance!

Thanks and Regards,
Kylasam N A

I don’t think you need to enter anything into docker-compose for this. You’ll just plug the publicly available URL for your SQL proxy into the data source setup screen within Redash.

Thanks a lot for your valuable response!
Does it mean, I need to run the cloudsql proxy stuffs inside my container and try for the connection?
If so, could you help me with which container I need to do that?
redash/nginx:latest
redash/redash:8.0.0.b32245
postgres:9.6-alpine
redis:5.0-alpine

Thanks a lot in advance!

Not at all. Redash is completely separate from your GCP instance. To connect Redash to a database in your GCP you would do so within Redash as though you were connecting to any normal database. You don’t need to change docker-compose because whatever you do in GCP is totally separate from what you do in AWS: it’s different compose files.

I tried connecting via the IP’s but getting error as “could not send SSL negotiation packet: Resource temporarily unavailable”. But the same DB instance was accessible via ckoud_sql_proxy in my local machine and airflow instance at GCP via the public IP.

That means a firewall is blocking traffic between ir Redash instance and the database. Make sure to whitelist your Redash server’s IP from the GCP console.

This sounds familiar to me! I’ll try that! thanks a tonn once again!

I followed so many steps in connecting but nothing worked! Finally, I installed cloud_sql_proxy inside the image “redash/redash:8.0.0.b3224” and started the demon ( worked fine )
In the GUI page, I could create a connection and test as well. But upon running a query, I’m getting an error
Error running query: could not connect to server: Connection refused Is the server running on host “127.0.0.1” and accepting TCP/IP connections on port 5432?

In the backend, I could see the same as,

2021/01/03 23:20:48 New connection for “<project?”

2021/01/03 23:20:48 Client closed local connection on 127.0.0.1:5432 ( Upon querying in Redash GUI)

Could someone help here please?