• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

serviceaccount

GCP List Instances with Service Account

September 23, 2020

Here’s how to list GCP instances with a specific service account.

gcloud compute instances list \
--project your-project-id \
--format="value(name,serviceAccounts[].email)" \
--filter="serviceAccounts.email=your-service-account@email.com AND name~\bwp"

gcloud compute instances list \ --project your-project-id \ --format="value(name,serviceAccounts[].email)" \ --filter="serviceAccounts.email=your-service-account@email.com AND name~\bwp"

I’m using filters to look for a specific service account, and any instance starting with ‘wp.’ \b means begins with.

Filed Under: Cloud Tagged With: gcp, instances, list, serviceaccount

  • Home
  • About
  • Archives

Copyright © 2023