Table of Content
The Cloud SDK is a set of tools for Cloud Platform.
- gcloud, access Google Compute Engine
- gsutil, access Google Cloud Storage
- bq, access Google BigQuery
- other products and services CLI
- developed in python so it shipped with bundled python 2.7
Here are easy steps to make it portable with msys64 on windows.
install Google Cloud
Follow this quickstart and download from link.
It will be installed to,
C:\Users\username\AppData\Local\Google\Cloud SDK
copy it to portable folder,
C:\oldhorse\portableapps\gcsdk
You can uninstall Cloud SDK or leave as backup.
portable gcloud
add below lines to profile or like me add to /etc/profile.d/portabledevops.sh (refer portabledevops).
# gcloud sdk if [ -d $PORTABLEPATH/gcsdk ]; then export PATH=$PORTABLEPATH/gcsdk/google-cloud-sdk/bin:$PATH export CLOUDSDK_PYTHON=$PORTABLEPATH/gcsdk/google-cloud-sdk/platform/bundledpython/python fi
verify portable gcloud
Will find 2 instances of gcloud, but portable one is first one,
$ which -a gcloud /C/oldhorse/portableapps/gcsdk/google-cloud-sdk/bin/gcloud /c/Users/oldhorse/AppData/Local/Google/Cloud SDK/google-cloud-sdk/bin/gcloud
gcloud init
We need to init gcloud configuration on msys64,
$ gcloud init Welcome! This command will take you through the configuration of gcloud. Settings from your current configuration [default] are: core: account: robert.lu.wang@gmail.com disable_usage_reporting: 'False' project: k8s-miniguide Pick configuration to use: [1] Re-initialize this configuration [default] with new settings [2] Create a new configuration Please enter your numeric choice: 1 Choose the account you would like to use to perform operations for this configuration: [1] robert.lu.wang@gmail.com [2] Log in with a new account Please enter your numeric choice: 1 You are logged in as: [robert.lu.wang@gmail.com]. Pick cloud project to use: [1] k8s-miniguide [2] Create a new project Please enter numeric choice or text value (must exactly match list item): 1 Your current project has been set to: [k8s-miniguide].
verify portable gcloud sdk
$ gcloud auth list
Credentialed Accounts
ACTIVE ACCOUNT
* robert.lu.wang@gmail.com
To set the active account, run:
$ gcloud config set account ACCOUNT
$ gcloud config list
[compute]
region = us-east1
zone = us-east1-b
[core]
account = robert.lu.wang@gmail.com
disable_usage_reporting = False
project = k8s-miniguide
Your active configuration is: [default]
also get good summary of gcloud sdk,
$ gcloud info Google Cloud SDK [183.0.0] Platform: [Windows, x86_64] ('Windows', 'XXXXXX', '7', '6.1.7601', 'AMD64', 'Intel64 Family 6 Model 60 Stepping 3, GenuineIntel') Python Version: [2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)]] Python Location: [C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\python.exe] Site Packages: [Disabled] Installation Root: [C:\oldhorse\portableapps\gcsdk\google-cloud-sdk] Installed Components: core: [2017.12.08] beta: [2017.09.15] gsutil: [4.28] bq: [2.0.27] System PATH: [C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\bin; Python PATH: [C:/oldhorse/portableapps/gcsdk/google-cloud-sdk/lib\third_party;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\lib;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\python27.zip;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\DLLs;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\lib;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\lib\plat-win;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython\lib\lib-tk;C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\platform\bundledpython] Cloud SDK on PATH: [True] Kubectl on PATH: [False] WARNING: There are old versions of the Google Cloud Platform tools on your system PATH. C:\Users\oldhorse\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin\bq.cmd Installation Properties: [C:\oldhorse\portableapps\gcsdk\google-cloud-sdk\properties] User Config Directory: [C:\Users\oldhorse\AppData\Roaming\gcloud] Active Configuration Name: [default] Active Configuration Path: [C:\Users\oldhorse\AppData\Roaming\gcloud\configurations\config_default] Account: [robert.lu.wang@gmail.com] Project: [k8s-miniguide] Current Properties: [core] project: [k8s-miniguide] account: [robert.lu.wang@gmail.com] disable_usage_reporting: [False] [compute] region: [us-east1] zone: [us-east1-b] Logs Directory: [C:\Users\oldhorse\AppData\Roaming\gcloud\logs] Last Log File: [C:\Users\oldhorse\AppData\Roaming\gcloud\logs\2017.12.22\10.31.39.500000.log] git: [git version 2.10.2] ssh: [OpenSSH_7.3p1, OpenSSL 1.0.2j 26 Sep 2016]