gcloud alpha resources list

gcloud alpha resources list - list Google Cloud resources accessible from your account
gcloud alpha resources list [--filter=FILTER] [--limit=LIMIT] [--page-size=PAGE_SIZE; default="500"] [--sort-by=[FIELD,…]] [--uri] [GCLOUD_WIDE_FLAG …]
(ALPHA) gcloud alpha resources list lists all indexed Google Cloud resources that you have access to. Filter expressions apply to the specific resource type selected.
A filter expression that is rewritten into a CloudResourceSearch query expression. It is applied to the resource specific data in the search results.

By default all indexed resources are listed. Use @type:COLLECTION to select resources for COLLECTION. It is an error to specify a COLLECTION not indexed by the API. The supported collections are:

  • cloudresourcemanager.projects
  • compute.disks
  • compute.healthChecks
  • compute.httpHealthChecks
  • compute.httpsHealthChecks
  • compute.images
  • compute.instanceGroups
  • compute.instances
  • compute.subnetworks
Collections named resources.RESOURCE-TYPE may be used for debugging, where RESOURCE-TYPE is defined by the CloudResourceSearch API.

See $ gcloud topic filters for filter expression details.

The maximum number of resources to list. The default is unlimited. This flag interacts with other flags that are applied in this order: --flatten, --sort-by, --filter, --limit.
--page-size=PAGE_SIZE; default="500"
Some services group resource list output into pages. This flag specifies the maximum number of resources per page. The default is determined by the service if it supports paging, otherwise it is unlimited (no paging). Paging may be applied before or after --filter and --limit depending on the service.
A comma-separated list of resource field key names to sort by. The default order is ascending. Prefix a field with ``~´´ for descending order on that field. This flag interacts with other flags that are applied in this order: --flatten, --sort-by, --filter, --limit.
Print a list of resource URIs instead of the default output.
These flags are available to all commands: --account, --configuration, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
List all compute instances URIs with names starting with test or prod:
  $ gcloud alpha resources list --uri \
      --filter="@type:compute.instances name:(test prod)"

Print the number of resources with any part containing the substring foobar:

  $ gcloud alpha resources list --filter="foobar" --uri | wc -l

The previous command uses --uri to count because each output line is the URI for one resource. Otherwise the resource descriptions could be multiple lines per resource.

This command is currently in ALPHA and may change without notice.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...