17
17
[ instructions] ( https://cloud.google.com/sql/docs/postgres/connect-external-app#4_if_required_by_your_authentication_method_create_a_service_account ) .
18
18
Download a JSON key to use to authenticate your connection.
19
19
20
- 1 . Use the information noted in the previous steps:
21
- ``` bash
22
- export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
23
- export CLOUD_SQL_CONNECTION_NAME=' <MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'
24
- export DB_USER=' my-db-user'
25
- export DB_PASS=' my-db-pass'
26
- export DB_NAME=' my_db'
27
- ```
28
- Note: Saving credentials in environment variables is convenient, but not secure - consider a more
29
- secure solution such as [ Cloud KMS] ( https://cloud.google.com/kms/ ) to help keep secrets safe.
30
-
31
20
## Running locally
32
21
33
22
To run this application locally, download and install the ` cloud_sql_proxy ` by
@@ -51,6 +40,8 @@ export DB_USER='<DB_USER_NAME>'
51
40
export DB_PASS=' <DB_PASSWORD>'
52
41
export DB_NAME=' <DB_NAME>'
53
42
```
43
+ Note: Saving credentials in environment variables is convenient, but not secure - consider a more
44
+ secure solution such as [ Cloud KMS] ( https://cloud.google.com/kms/ ) to help keep secrets safe.
54
45
55
46
Then use this command to launch the proxy in the background:
56
47
``` bash
@@ -66,6 +57,8 @@ $env:DB_USER="<DB_USER_NAME>"
66
57
$env:DB_PASS="<DB_PASSWORD>"
67
58
$env:DB_NAME="<DB_NAME>"
68
59
```
60
+ Note: Saving credentials in environment variables is convenient, but not secure - consider a more
61
+ secure solution such as [ Cloud KMS] ( https://cloud.google.com/kms/ ) to help keep secrets safe.
69
62
70
63
Then use this command to launch the proxy in a separate PowerShell session:
71
64
``` powershell
@@ -96,6 +89,8 @@ export DB_USER='<DB_USER_NAME>'
96
89
export DB_PASS=' < DB_PASSWORD> '
97
90
export DB_NAME=' < DB_NAME> '
98
91
```
92
+ Note: Saving credentials in environment variables is convenient, but not secure - consider a more
93
+ secure solution such as [Cloud KMS](https://cloud.google.com/kms/) to help keep secrets safe.
99
94
100
95
Then use this command to launch the proxy in the background:
101
96
```bash
0 commit comments