To list your clusters, you can use the Google Cloud console, the Google Cloud CLI, the client library, or the Managed Kafka API. You can't use the open source Apache Kafka API to list a cluster.
Required roles and permissions to list your clusters
To get the permissions that you need to list your clusters,
ask your administrator to grant you the
Managed Kafka Viewer (roles/managedkafka.viewer
) IAM role on your project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to list your clusters. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to list your clusters:
-
List clusters:
managedkafka.clusters.list
-
Get cluster details:
managedkafka.clusters.get
You might also be able to get these permissions with custom roles or other predefined roles.
For more information about the Managed Kafka Viewer role, see Managed Service for Apache Kafka predefined roles.
List your clusters
To list all your clusters in a project, follow these steps:
Console
In the Google Cloud console, go to the Clusters page.
- The clusters you created in a project are listed. The page lets you
view the following cluster properties:
- Cluster name: The unique identifier for your Managed Service for Apache Kafka cluster. You can use it to reference the cluster in various operations.
- Cluster state: Indicates the current operational status of the cluster, such as Active.
- Region: The geographical location where your Managed Kafka cluster is hosted.
- Memory: The total amount of memory allocated to the cluster. This determines the capacity for handling message traffic and storage.
- vCPU: The number of vCPUs assigned to the cluster. This affects the cluster's processing power and ability to handle concurrent operations.
- Labels: Key-value pairs that you can attach to the cluster for organization, filtering, and automation purposes.
gcloud
-
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.
Run the
gcloud beta managed-service-for-apache-kafka clusters list
command:gcloud beta managed-kafka clusters list --location=LOCATION \ --limit=LIMIT
Replace the following:
-
LOCATION: The location of the cluster.
-
LIMIT: The maximum number of clusters to list.
-