gcloud compute instances list [NAME …] [--regexp=REGEXP, -r REGEXP] [--zones=ZONE,[ZONE,…]] [--filter=EXPRESSION] [--limit=LIMIT] [--page-size=PAGE_SIZE] [--sort-by=[FIELD,…]] [--uri] [GCLOUD_WIDE_FLAG …]
gcloud compute instances list displays all Google Compute Engine
instances in a project.
By default, instances from all zones are listed. The results can be narrowed
down using a filter: --filter="zone:( ZONE … )".
NAME …]
Argument NAME is deprecated. Use --filter="name=( 'NAME'
… )" instead.
--regexp=REGEXP, -r REGEXP
Flag --regexp is deprecated. Use
--filter="name~'REGEXP'" instead.
--zones=ZONE,[ZONE,…]--filter=EXPRESSIONEXPRESSION to each resource item
to be listed. If the expression evaluates True, then that item is
listed. For more details and examples of filter expressions, run $ gcloud topic filters. This flag
interacts with other flags that are applied in this order:
--flatten, --sort-by, --filter,
--limit.
--limit=LIMITunlimited. This
flag interacts with other flags that are applied in this order:
--flatten, --sort-by, --filter,
--limit.
--page-size=PAGE_SIZEunlimited (no paging).
Paging may be applied before or after --filter and
--limit depending on the service.
--sort-by=[FIELD,…]--flatten, --sort-by, --filter,
--limit.
--uri--format, the formatting is applied on this URI list. To display
URIs alongside other keys instead, use the uri() transform.
Run $ gcloud help for details.
gcloud compute instances list
To list the URIs of all instances in a project, run:
gcloud compute instances list --uri
To list all instances in the
and us-central1-b zones, run:
europe-west1-d
gcloud compute instances list --filter="zone:( us-central1-b europe-west1-d )"
gcloud alpha compute instances list
gcloud beta compute instances list