Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for gcp

September 23, 2020

GCP List Instances with Service Account

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.

September 21, 2020

GCP Listing Reservations

Here’s how to list reservations in GCP.

gcloud compute reservations list --project project-id

gcloud compute reservations list --project project-id

Specify a zone.

gcloud compute reservations list \
--filter="zone:('us-central1-a')" \
--project project-id

gcloud compute reservations list \ --filter="zone:('us-central1-a')" \ --project project-id

September 16, 2020

GCP Identify Your Disks

Here’s how to identify your disks on the system to cross check with GCP Dashboard.

ls -l /dev/disk/by-id

ls -l /dev/disk/by-id

Result:

[root@servername ~]# ls -l /dev/disk/by-id
total 0
lrwxrwxrwx. 1 root root  9 Sep 15 05:30 google-boot -> ../../sda
lrwxrwxrwx. 1 root root 10 Sep 15 05:30 google-boot-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  9 Sep 15 05:30 google-persistent-disk-1 -> ../../sdb
lrwxrwxrwx. 1 root root  9 Sep 15 05:30 scsi-0Google_PersistentDisk_boot -> ../../sda
lrwxrwxrwx. 1 root root 10 Sep 15 05:30 scsi-0Google_PersistentDisk_boot-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  9 Sep 15 05:30 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb

[root@servername ~]# ls -l /dev/disk/by-id total 0 lrwxrwxrwx. 1 root root 9 Sep 15 05:30 google-boot -> ../../sda lrwxrwxrwx. 1 root root 10 Sep 15 05:30 google-boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Sep 15 05:30 google-persistent-disk-1 -> ../../sdb lrwxrwxrwx. 1 root root 9 Sep 15 05:30 scsi-0Google_PersistentDisk_boot -> ../../sda lrwxrwxrwx. 1 root root 10 Sep 15 05:30 scsi-0Google_PersistentDisk_boot-part1 -> ../../sda1 lrwxrwxrwx. 1 root root 9 Sep 15 05:30 scsi-0Google_PersistentDisk_persistent-disk-1 -> ../../sdb

  • « Previous Page
  • 1
  • 2
  • 3
  • 4
  • …
  • 22
  • Next Page »
  • Cloud
  • Linux
  • Git

Copyright © 2012–2021