Now that we have our new WSL only development environment in VSCode we can extend our developers environment to support a Google Cloud Platform back-end. The side project I am working on is hosted in GCP so it’s natural to extend our environment to support this. In another article we will create a React Native application to listen for Firebase Cloud Messages in GCP.
This deployment follows the instructions located on GCP’s website linked here for the latest version:
https://cloud.google.com/sdk/docs/downloads-interactive#linux
First we run this single command:
curl https://sdk.cloud.google.com | bash
That command executes a full installation of the Google Cloud SDK, I tried the apt-get install first but it wound up not working as it couldn’t find certain packages in the repository. First thing the script will ask you for is the base directory for your package installation, which in my case I chose the default /home/<username>
That means from now on, your most recent version of the Google Cloud SDK files will be located in:
/home/<username>/google-cloud-sdk
This doesn’t exactly match where our React Native project files will be or the location of our android SDK path. So it’s important to note. It makes sense to install here however as the SDK tools are really only for your specific project and the specific cloud access you need.
The script then proceeds to download all the appropriate files and code, asks if you want to contribute your anonymous data for error reporting and then kicks off the install.
Once the installation is complete the installer will ask if you would like your PATH modified to enable shell command completion, I recommend this.
Accept the default file for this if it is your current .rc file and then restart your WSL instance.
You should be good to go now! You can test it out in a new project folder by typing:
gcloud init
The script will take you through several steps to link your SDK to google cloud platform, including authenticating to your GCP account, what cloud project you are using and what default compute engine zone you would like to use. Once that is complete you should get a message similar to this:
Congratulations, you are now linked to Google Cloud Platform!