Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

connect to postgres server on google compute engine

I have searched for this everywhere but after an hour and a half of searching I've not found anything relevant.

How do I connect to a database on my google compute engine? i.e I want to connect to the postgres server running on my google compute engine using pgadmin3 from my laptop.

Is this even possible? If so how do I go about it?

Thanks in advance!

like image 853
Prasanjit Prakash Avatar asked Feb 12 '23 14:02

Prasanjit Prakash


1 Answers

You need to:

  • Ensure Postgres is listening for TCP traffic (you can check that by connecting to your instance and running netstat -ntpl). Usually, Postgres will be listening on port 5432.
  • Ensure there is no local firewall blocking traffic to Postgres' port on the instance (you can run iptables -L)
  • Ensure there is no GCE firewall blocking traffic to your instance on Postgres' port from your IP. You should read this documentation page, and specifically the "firewalls" section
like image 177
Thomas Orozco Avatar answered Apr 27 '23 16:04

Thomas Orozco