GCP Add IAM Role to Service Account

Here’s how to add an IAM role to a GCP Service Account.

gcloud projects add-iam-policy-binding your-project-id \
--member serviceAccount:service-account-name@your-project-id.iam.gserviceaccount.com \
--role roles/storage.objectAdmin

GCP SDK Update

Here’s how to update your Google Cloud Platform SDK (Software Development Kit) which is aka the CLI for interacting with Google’s API.

Get Current Version

gcloud version

Get the Components List

gcloud components list

Update

gcloud components update

GCP Compute Disks Move

Here’s how to move a GCP disk between zones.

  1. Make sure disk is detached from instance.
  2. Use the GCloud Disk Move command.
# Detach disk from instance
gcloud compute instances detach-disk server --disk=server-boot
# Move disk from us-central1-b to us-central1-f
gcloud compute disks move example-disk-1 --zone us-central1-b --destination-zone us-central1-f

GCloud Interactive Shell

If you already have Google SDK installed, you can activate GCloud Interactive Shell, which is still in beta by the way, by typing the following command from the Google SDK terminal.

gcloud beta interactive

The interactive shell environment has auto-completion. It shows you who’s logged in and which project you are currently set in. To exit the interactive shell, just Press F9 to quit.