gcloud-cli

How to configure multiple gcloud projects

风格不统一 提交于 2021-02-11 05:18:40
问题 On my work laptop, i have gcloud configured with our prod projects. when i do gcloud config configurations list , I get only one row in result, which is ACTIVE and it's my work-project. Now for some personal testing, I have created a separate project which is associated with my personal email id. How would i configure/connect this project with my gcloud cli? I have tried gcloud auth application-default login which opened the browser, i signed in using personal email id. The webpage showed me

How to configure multiple gcloud projects

走远了吗. 提交于 2021-02-11 05:08:33
问题 On my work laptop, i have gcloud configured with our prod projects. when i do gcloud config configurations list , I get only one row in result, which is ACTIVE and it's my work-project. Now for some personal testing, I have created a separate project which is associated with my personal email id. How would i configure/connect this project with my gcloud cli? I have tried gcloud auth application-default login which opened the browser, i signed in using personal email id. The webpage showed me

GCloud custom image upload failure due to size or permissions

丶灬走出姿态 提交于 2021-01-29 15:53:15
问题 I've been trying to upload two custom images for some time now and I have failed repeatedly. During the import process the Google application always responds with the message that the Compute Engine Default Service Account does not have the role 'roles/compute.storageAdmin'. However, I have both assigned it using the CLI as the webinterface. Notable is that the application throws this error during resizing of the disk. The original size of the disk is about 10GB, however, it tries to convert

List all the tables in a dataset in bigquery using bq CLI and store them to google cloud storage

≡放荡痞女 提交于 2020-08-02 05:34:28
问题 I have around 108 tables in a dataset. I am trying to extract all those tables using the following bash script: # get list of tables tables=$(bq ls "$project:$dataset" | awk '{print $1}' | tail +3) # extract into storage for table in $tables do bq extract --destination_format "NEWLINE_DELIMITED_JSON" --compression "GZIP" "$project:$dataset.$table" "gs://$bucket/$dataset/$table.json.gz" done But it seems that bq ls only show around 50 tables at once and as a result I can not extract them to

List all the tables in a dataset in bigquery using bq CLI and store them to google cloud storage

若如初见. 提交于 2020-08-02 05:33:33
问题 I have around 108 tables in a dataset. I am trying to extract all those tables using the following bash script: # get list of tables tables=$(bq ls "$project:$dataset" | awk '{print $1}' | tail +3) # extract into storage for table in $tables do bq extract --destination_format "NEWLINE_DELIMITED_JSON" --compression "GZIP" "$project:$dataset.$table" "gs://$bucket/$dataset/$table.json.gz" done But it seems that bq ls only show around 50 tables at once and as a result I can not extract them to

Gcloud command line get default project_id

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-22 05:35:05
问题 I'm looking for a one-liner to get the default project id with gcloud config list core/project give me Your active configuration is: [default] [core] project = myproject_id While I want to have only myproject_id. The goal is to use the result in a script. 回答1: The easiest way to do this is to use the --format flag on gcloud. gcloud config list --format 'value(core.project)' 2>/dev/null The --format flag is available on all commands and gives you full control over what is printed, and how it

Can I automate Google Cloud SDK gcloud init - interactive command

跟風遠走 提交于 2019-12-29 02:57:24
问题 Documentation on Google Cloud SDK https://cloud.google.com/sdk/docs/ directs one to run gcloud init after installing it. Is there a way to automate this step given that gcloud init is an interactive command? 回答1: One does not need to run gcloud init . Main goal is to make sure credentials are configured and perhaps the project property is set. If you have service-account credentials, gcloud can be configured and ready to go via the following: gcloud auth activate-service-account --key-file

Can I automate Google Cloud SDK gcloud init - interactive command

柔情痞子 提交于 2019-12-29 02:57:06
问题 Documentation on Google Cloud SDK https://cloud.google.com/sdk/docs/ directs one to run gcloud init after installing it. Is there a way to automate this step given that gcloud init is an interactive command? 回答1: One does not need to run gcloud init . Main goal is to make sure credentials are configured and perhaps the project property is set. If you have service-account credentials, gcloud can be configured and ready to go via the following: gcloud auth activate-service-account --key-file

how to update a GAE app with GCLOUD via socks5 proxy

别来无恙 提交于 2019-12-25 18:29:41
问题 i created my GAE app in development console. i use to update it using appcfg. now i am behind a socks5 proxy, and couldnt find the way to set appcfg to go through. can someone reply all the steps to do it please ? could be using appcfg or gcloud tools thank you very much 回答1: You can use accpcfg or gcloud behind a proxy by setting the HTTP_PROXY or HTTPS_PROXY environment variables. For example, on windows: set HTTP_PROXY=http://cache.mycompany.com:3128 set HTTPS_PROXY=http://cache.mycompany

How can I check if a Google VM instance has already credentials for gcloud

孤街浪徒 提交于 2019-12-11 00:59:08
问题 In order not to call every time: gcloud auth login which would interrupt a script for user input I would like to see if a user is already authenticated (any user) and only if no user, then to call gcloud auth login . I would love a more elegant/reliable solution than scraping the output of gcloud auth list . Something like a ping that fails or succeeds if there is an account already AND the account has the right to do the thing. Maybe a --dry-run option? 回答1: Being logged in means having