How can I push data to a PostgreSQL database in Google Cloud?

This topic was automatically generated from Slack. You can find the original thread here.

Kyle Schiess : How can I push data to a postgresql database in google cloud?

Dylan Sather (Pipedream) : try copying this workflow and entering the details of your Postgres DB in the PostgreSQL connected account: PostgreSQL example - Pipedream

Dylan Sather (Pipedream) : you can execute any query you’d like against your DB, that example just shows an end to end example using a trivial SELECT

Kyle Schiess : Does that client constructor look right?

Dylan Sather (Pipedream) : Have you opened up your database’s firewall to allow traffic on port 5432?

Dylan Sather (Pipedream) : just a small note that you don’t need to hardcode those credentials in the workflow. The workflow is written to accept the credentials you linked in the connected account

Kyle Schiess : Maybe I have to add pipedream as an authorized network?

Kyle Schiess : Is there an IP address listed for this purpose?

Dylan Sather (Pipedream) : Not currently, but we’re tracking that here: I'd like a list of public IP addresses tied to traffic sent from my workflow · Issue #178 · PipedreamHQ/pipedream · GitHub .

Others have used a workflow like this to tunnel PostgreSQL queries through another server, via SSH. That’s a bit more work but then it’d let you limit traffic to your Postgres DB.

Kyle Schiess : Yeah just took a dive into setting up OpenSSH. Not a joke lol

Dylan Sather (Pipedream) : It’s definitely non-trivial. You’ll find some good guides online if you search the keywords “ssh bastion host”

Dylan Sather (Pipedream) : But you’ll feel awesome the first time you get it working end to end!

Kyle Schiess : I know this is just tangentially related, but do you ever see anything like this? Not sure if I can’t type anything because it doesn’t allow you to see your password, or I just have the wrong password

image.png

Dylan Sather (Pipedream) : yeah there are a few things that could be wrong: you could have the wrong username, password could be different (it is typing your password, ssh just hides it for security), etc.

Kyle Schiess : Ah well, I think I screwed it up. The password I have written down just doesn’t work.

Do you know what everyone typically does? Like do they run SSH on a VM?

Dylan Sather (Pipedream) : yes, if you’re running in a cloud platform, typically you’ll spin up a VM that opens up port 22 to the world (0.0.0.0/0), and configure user accounts on that VM / host.

Did you happen to see this article? Seems like a good intro (with links to a lot of resources for GCP specifically): Creating an SSH Bastion host in Google Cloud VPC | by JM | Medium

Kyle Schiess : That’s just what I was looking for