This page shows you how to list the Cloud Storage buckets in a project, which are ordered in the list lexicographically by name.
Before you begin
To get the permissions that you need to list buckets, ask your administrator to
grant you the Storage Admin ( roles/storage.admin
) IAM role or
the Viewer ( roles/viewer
) basic role on the project that contains the buckets
you want to list.
For more information about granting roles for projects, see Manage access to projects .
The roles contain the storage.buckets.list
permission, which is
required to list buckets. You can also get this permission with custom roles
.
List the buckets in a project
Console
- In the Google Cloud console, go to the Cloud Storage Buckets
page.
Buckets that are part of the currently selected project appear in the list.
Optionally, use filtering and sorting to limit and organize the results in your list.
Command line
-
In the Google Cloud console, activate Cloud Shell.
At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.
-
In your development environment, run the
gcloud storage ls
command:gcloud storage ls
The response looks like the following example:
gs:// BUCKET_NAME1 / gs:// BUCKET_NAME2 / gs:// BUCKET_NAME3 / ...
Client libraries
C++
For more information, see the Cloud Storage C++ API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
C#
For more information, see the Cloud Storage C# API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Go
For more information, see the Cloud Storage Go API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Java
For more information, see the Cloud Storage Java API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Node.js
For more information, see the Cloud Storage Node.js API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
PHP
For more information, see the Cloud Storage PHP API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Python
For more information, see the Cloud Storage Python API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .
Ruby
For more information, see the Cloud Storage Ruby API reference documentation .
To authenticate to Cloud Storage, set up Application Default Credentials. For more information, see Set up authentication for client libraries .