Reputation: 11
I have installed gcloud/bq/gsutil command line tool in one linux server. And we have several accounts configured in this server.
**gcloud config configurations list**
NAME IS_ACTIVE ACCOUNT PROJECT DEFAULT_ZONE DEFAULT_REGION
gaa True [email protected] a
gab False [email protected] b
Now I have problem to both run gaa/gab in this server at same time. Because they have different access control on BigQuery and Cloud Stroage. I will use below commands (bq and gsutil commands):
Set up account
Gcloud config set account [email protected]
Copy data from bigquery to Cloud
bq extract --compression=GZIP --destination_format=NEWLINE_DELIMITED_JSON 'nl:82421.ga_sessions_20161219' gs://ga-data-export/82421/82421_ga_sessions_20161219_*.json.gz
Download data from Cloud to local system
gsutil -m cp gs://ga-data-export/82421/82421_ga_sessions_20161219*gz
If only run one account, it is not a problem. But there are several accounts need to run on one server at same time, I have no idea how to deal with this case.
Upvotes: 1
Views: 968
Reputation: 21384
Per the gcloud
documentation on configurations, you can switch your active configuration via the --configuration
flag for any gcloud
command. However, gsutil
does not have such a flag; you must set the environment variable CLOUDSDK_ACTIVE_CONFIG_NAME
:
$ # Shell 1
$ export CLOUDSDK_ACTIVE_CONFIG_NAME=gaa
$ gcloud # ...
$ # Shell 2
$ export CLOUDSDK_ACTIVE_CONFIG_NAME=gab
$ gsutil # ...
Upvotes: 1