I just created a google cloud postgres with very basic authorization by whitelist the ip.
I successfully connected to the google cloud postgres (35.240.xx.xx) from my home (139.193.xx.xx) using pgadmin and successfully created tables and inserted initial ddl.
When I want to use it in the shared hosting (119.81.xx.xx) that hosts laravel php application, I changed it in the .env file as below.
DB_CONNECTION=pgsql
DB_HOST=35.240.xx.xx
DB_PORT=5432
DB_DATABASE=postgres
DB_USERNAME=postgres
DB_PASSWORD=[google cloud password here]
But it didn't connect when I run the website with laravel.log as below.
[2018-07-12] ERROR: SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "35.240.xx.xx" and accepting TCP/IP connections on port 5432? {"exception":"[object] (PDOException(code: 7): SQLSTATE[08006] [7] could not connect to server: Connection refused
Can anyone help me? Thanks.