glcoud
Config
- gcloud config reference
- Completion files:
~/.local/share/mise/installs/gcloud/latest/completion.*
(usingbashcompinit
)
Configuration files are stored under ~/.config/gcloud/configurations
In addition to setting properties in a configuration, and the use of flags, it is possible to override the value of a property with an environment variable. The matching environment variable for a property is of the form 'CLOUDSDK_CATEGORY_PROPERTY'. For example, to demonstrate overriding the project property in the core category to my-project, use a command like: CLOUDSDK_CORE_PROJECT=my-project gcloud config get core/project
Installation
AUR packages
google-cloud-cli
(~500 mb) )google-cloud-cli-lite
(strips unnecessary dependencies to reduce the size by > 75%)
Components installation doesn't work with AUR packages:
$ gcloud components install config-connector
ERROR: (gcloud.components.install) You cannot perform this action
because this Google Cloud CLI installation is managed by an external package manager.
Please consider using a separate installation of the Google Cloud CLI
created through the default mechanism described at: https://cloud.google.com/sdk/
Therefore it's preferred to install gcloud by other means.
mise
mise use -g gcloud
Components
beta
:gcloud beta
commandsconfig-connector
: i.e. export GCP resources as OpenTofu resources
gke-gcloud-auth-plugin
Install as gcloud component, i.e.:
gcloud components install config-connector
Install as AUR package:
pamac install google-cloud-cli-gke-gcloud-auth-plugin
General usage
Filters
List domains without pendingContactSettings
:
gcloud domains registrations list \
--filter "pendingContactSettings.adminContact=.*" --format "table[no-heading](DOMAIN)"
Auth login
gcloud auth login
Proxy / custom CA cert
Use the ca cert bundle (including custom certs):
gcloud config set core/custom_ca_certs_file /etc/ssl/cert.pem
Cloud SQL
gcloud sql backups list --instance=mastodon
gcloud sql backups create --instance=mastodon \
--description="Manual before instance upgrade"
Projects
List all projects belonging to an organization:
gcloud beta asset search-all-resources \
--asset-types=cloudresourcemanager.googleapis.com/Project \
--scope=organizations/1234