Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

gcloud instance-group list-instances returns 0 items

Hi everyone!

We have a script that for each instance group listed under gcloud instance-group list output, we list the instances under it.

We use this command for execution:

gcloud compute instance-groups list-instances <ig_name> --region=<ig_region>

We've found out that when an instance group is a multiple zone(e.g europe-west3 (3/3)), we don't get the instances attached to it, but when it is a single zone (e.g europe-west3-a) we do get the instances attached to it.

Nothing in our script have changed in the last 2 years, I've tried few things like specifying --region, using the instance specific zone, all resulted in "Listed 0 items"

Even using SDK didnt work at all, as when we specified zone="europe-west3" we got invalid parameter, which is the right error as it is a region.

Anyone knows anything about it? Seems like a bug.

0 1 157
1 REPLY 1

Hi, @gsitk.

There seems to be some miscommunication regarding the data you've provided. Could you please confirm the details?

  • The zone value should be specified as something like europe-west3-a but I noticed you're using zone=europe-west3, which is not the correct format. If you're referring to europe-west3, it should be specified as a region instead.
  • You mentioned that you tried using the SDK but it still didn't work. Make sure you’re using an up-to-date version of the Google Cloud SDK.
  • Check if any changes to API quotas or service limits, have occurred that might restrict the ability to list instances across multiple zones. Sometimes, API behavior can be impacted by limitations at the regional level.
  • To rule out the possibility of a script or command issue, try to view the instance group and instances in the Google Cloud Console. This will confirm whether the issue lies with the gcloud command or the configuration of the instance group itself.
  • Use the --verbosity flag to get more detailed output when running the command, as -

 

gcloud compute instance-groups list-instances <ig_name> --region=<ig_region> --verbosity=debug

 

Regards,
Mokit