A
A
Anrek2021-11-15 20:51:56
Google Cloud Platform
Anrek, 2021-11-15 20:51:56

How to connect to Google Cloud database?

Hello!

There is a working project on Google App Engine with a database. I need to connect to a database through my small script with multiple requests (node ​​js script). With this script deployed on my computer. Those. so that 2 "clients" access the database: a working back-end in Google and my script on my computer.

I downloaded the Cloud SDK, now I have a shell for it, I went into my project through my academic record. If I enter gcloud config list in it, it appears that everything is OK, like this:

[compute]
region = us-west1
zone = us-west1-b
[core]
screen_reader = False
account = *redacted*
disable_usage_reporting = True
project = *redacted*


but if I try to enter the same thing through the VSCode console, then he no longer understands my command.

Questions:

1) the fact that in one console the command is understood, but in the other it is not connected with the console, or have I configured something wrong? If not, how do you set it up?
2) What to do next? how to connect my script to google database? The ultimate goal is to test a few requests - write requests to my script through Postman, so that the script processes them and requests some data from the Google database.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anrek, 2022-03-05
@Anrek

I solved this issue in 2 ways and a 3rd one is still possible.
1) through pgAdmin to directly change the database, get data from there, etc., the instruction is here .
2) via connection string for postgresql directly from the code, instructions are here .
3) you could also use what google suggested, it indicates connection options from a variety of places, for example, the instruction for client from a local machine is here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question