Installing Google SDK - steviep42/immport GitHub Wiki
Working with Google Cloud from Your Laptop
Everyone seems to be using Apple laptops so these instructions will related to Apples although this is possible on both Windows and Linux setups. So first go to this link which is Google's source of information for accessing the project's cloud resources via the Terminal. This is useful for syncing files and folders remotely and locally. Some of the code we are likely to run can be done locally whereas more aggressive work will probably need to be done on a Google cloud instance. Make sure that you have Python installed on your laptop. This is typically installed by default. Some of the newer Macs have Python version 3 installed and if you have Anaconda or Miniconda and are managing Python that way these instructions should still apply. Get the 64 bit tools.
https://github.com/steviep42/immport/blob/master/images/mac_641.png
After downloading the appropriate file do the following to unzip and de-tar the file so you can install the SDK locally.
$ cd Downloads
$ gzip -dc google-cloud-sdk-231.0.0-darwin-x86_64.tar.gz | tar -xvf -
$ cd google-cloud-sdk
# Run the Installer Script
$ google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Modify profile to update your $PATH and enable shell command completion?
Do you want to continue (Y/n)?
Your current Cloud SDK version is: 231.0.0
The latest available version is: 231.0.0
The Google Cloud SDK installer will now prompt you to update an rc file to
bring the Google Cloud CLIs into your environment.
Enter a path to an rc file to update, or leave blank to use
[/Users/esteban/.bash_profile]:
Initializing the SDK
You could refer to the Google Doc to see how to initialize your environment though I'll show you how mine looks. You already have access to the cloud resources since your id is already associated with the project. However, if you are like me then you might have several Google ids or are managing different projects. The good news is that if this is the case then you can easily switch between projects or ids. If you have just one Google id then it's really simple.
$ gcloud init
Welcome! This command will take you through the configuration of gcloud.
Settings from your current configuration [immport] are:
compute:
region: us-east1
zone: us-east1-b
core:
account: [email protected]
disable_usage_reporting: 'True'
project: reference-database
Pick configuration to use:
[1] Re-initialize this configuration [immport] with new settings
[2] Create a new configuration
[3] Switch to and re-initialize existing configuration: [default]
Please enter your numeric choice: 1
Your current configuration has been set to: [immport]
Choose the account you would like to use to perform operations for
this configuration:
[1] [email protected]
[2] [email protected]
[3] Log in with a new account
Please enter your numeric choice: 2
You are logged in as: [[email protected]].
Pick cloud project to use:
[1] reference-database
[2] test-project-221120
[3] Create a new project
Please enter numeric choice or text value (must exactly match list): 1
Your current project has been set to: [reference-database].
Do you want to configure a default Compute Region and Zone? (Y/n)? Y
Which Google Compute Engine zone would you like to use as project default?
If you do not specify a zone via a command line flag while working with Compute
Engine resources, the default is assumed.
[1] us-east1-b
[2] us-east1-c
[3] us-east1-d
[4] us-east4-c
[5] us-east4-b
..
..
[47] europe-north1-a
[48] europe-north1-b
[49] europe-north1-c
[50] northamerica-northeast1-a
Enter "list" at prompt to print choices fully.
Please enter numeric choice or text value (must exactly match list item): 1
Your project default Compute Engine zone has been set to [us-east1-b].
You can change it by running [gcloud config set compute/zone NAME].
Your project default Compute Engine region has been set to [us-east1].
You can change it by running [gcloud config set compute/region NAME].
Your Google Cloud SDK is configured and ready to use!
* Commands that require authentication will use [email protected] by default
* Commands will reference project `reference-database` by default
* Compute Engine commands will use region `us-east1` by default
* Compute Engine commands will use zone `us-east1-b` by default
Run `gcloud help config` to learn how to change individual settings
This gcloud configuration is called [immport]. You can create additional
configurations if you work with multiple accounts and/or projects.
Run `gcloud topic configurations` to learn more.