Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Cloud/GCP Instances By Service Account

April 14, 2020

GCP Instances By Service Account

Here’s how to get a list of GCP instances using a specific service account.

gcloud compute instances list \
--filter="serviceAccounts.email=service-account@domain.com" \
--project project-id

gcloud compute instances list \ --filter="serviceAccounts.email=service-account@domain.com" \ --project project-id

To display all instances and their service accounts in JSON format.

gcloud compute instances list \
--format="json(name,serviceAccounts[].email)" \
--project your-project-id

gcloud compute instances list \ --format="json(name,serviceAccounts[].email)" \ --project your-project-id

Display in YAML which is also the Default.

gcloud compute instances list \
--format="default(name,serviceAccounts[].email)" \
--project your-project-id

gcloud compute instances list \ --format="default(name,serviceAccounts[].email)" \ --project your-project-id

Filed Under: Cloud Tagged With: compute, gcp, instances, list, service account

Have content delivered to your mail. Subscribe below.

About Me

I'm Ulysses, Cloud Engineer at Cardinal Health based in Columbus. This blog is about Linux and Cloud technology. When off the grid, I enjoy riding my electric skateboard. I've surfed, snowboarded and played the saxophone in the past. I hope you find this website helpful. It's powered by WordPress and hosted on AWS LightSail.

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021