Google Cloud SDK with Service Account on Raspberry Pi

Using a Raspberry Pi to interact with your Google Cloud Platform projects without having to expose your user credentials.

GCP and Raspberry Pi Logos
GCP and Raspberry Pi Logos

Create the Service Account

Screenshot showing GCP Create Service acount dialog
Screenshot showing GCP Create Service acount dialog

Install the Google Cloud SDK

sudo useradd -m bigquery-speedtest-loader
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get install apt-transport-https ca-certificates gnupg
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -
sudo apt-get update && sudo apt-get install google-cloud-sdk
sudo su - bigquery-speedtest-loader
mkdir .private/vi .private/name-of-JSON-file.json
gcloud auth activate-service-account bigquery-speedtest-loader@bq-jake.iam.gserviceaccount.com --key-file=/home/bigquery-speedtest-loader/.private/name-of-JSON-file.json
bigquery-speedtest-loader@vpn-edge:~/.private $ gcloud auth list                      Credentialed Accounts
ACTIVE ACCOUNT
* bigquery-speedtest-loader@bq-jake.iam.gserviceaccount.com
To set the active account, run:
$ gcloud config set account `ACCOUNT`

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store