Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What gcloud command would list all the resources with a specific network tag?

I am reviewing firewall rules and would like to identify the specific resources for which that firewall rule applies (i.e. the resources with the specified network tag). I know this can be seen in the console by clicking on the specific firewall rule, however, I would like to do this much faster with a gcloud command.

I've reviewed the documentation here but I can't seem to work out the command for how to simply list the resources with a specific network tags.

like image 846
ellefc Avatar asked Dec 04 '25 12:12

ellefc


1 Answers

The gcloud tools make this search available via the --filter command line flag. The command below will list all compute instances in GCE with the specific network tag. DOCS: https://cloud.google.com/sdk/gcloud/reference/topic/filters

gcloud compute instances list --filter="tags.items=<insert network tag>"
like image 105
elavenrac Avatar answered Dec 12 '25 07:12

elavenrac