Manage Topics in Confluent Cloud¶
An Apache Kafka® topic is a category or feed that stores messages. Producers send messages and write data to topics, and consumers read messages from topics. Topics are grouped by cluster within environments.
You can apply schemas to topics.
This page provides steps to create, edit, and delete Kafka topics in Confluent Cloud using the Cloud Console or the Confluent CLI. You can also list, create or delete topics with REST APIs.
Access Topics¶
To access topics in Cloud Console:
- Sign in to your Confluent Cloud account.
- Choose an environment and then a cluster.
- From the Navigation menu, choose Topics.
- Choose a topic from the displayed list, or click the Create topic button to create a topic.
Important
When private networking is enabled, some Cloud Console components, including topic management, use cluster endpoints that are not publicly reachable. You must configure your network to route requests for these components over the private connection. For details, see Use Confluent Cloud with Private Networking for details.
Create topics¶
The following steps describe how to create a topic using the Cloud Console or Confluent CLI. For details about configuration settings, see Manage Kafka Cluster Configuration Settings in Confluent Cloud.
Follow these steps to create a topic with the Cloud Console:
Sign in to Confluent Cloud.
If you have more than one environment, select an environment.
Select a cluster.
Select Topics in the navigation menu. The Topics page appears.
If there aren’t any topics created yet, select Create topic. Otherwise, select Add a topic.
Specify your topic details and click Create with defaults. For advanced topic settings, select Customize settings.
Note
To create a topic with Infinite Storage, on the New Topic page, select
Show advanced settings and choose Infinite for Retention time.
This sets retention.ms
to -1.
Follow these steps to create a topic with the Confluent CLI:
Sign in to your Confluent Cloud account with the Confluent CLI. When prompted, enter a valid email and password for your Confluent Cloud account.
confluent login
Use the
confluent kafka topic create
command to create a topic. The following example creates a topic namedusers
in the clusterlkc-someID
:confluent kafka topic create users --cluster lkc-someID
The output is similar to the following:
Created topic "users".
Note
You can create a topic with Infinite Storage by specifying -1 for retention.ms
.
confluent kafka topic create users --cluster lkc-someID --config retention.ms=-1
See the full list of options in the
command reference for confluent kafka topic create
.
To learn more about using the Confluent CLI with Confluent Cloud, see Connect the Confluent CLI to Confluent Cloud.
Follow these steps to create a topic with the Confluent for VS Code extension.
In Confluent for VS Code, log in to Confluent Cloud.
If no topics are shown in the Topics pane, click Select Kafka cluster and select a cluster from the list.
In the Topics pane, hover over the TOPICS header to show the available commands and click +.
The Create a new topic dialog opens.
Type the name of the new topic and press Enter.
Enter the partition count and press Enter.
Enter the replication count and press Enter.
The topic is created and displayed in the Topics pane. If you have many topics in the cluster, you may need to scroll to see it.
For more information, see Confluent for VS Code for Confluent Cloud.
Edit topics¶
When editing topic settings, remember the following:
- You can edit certain topic configurations after a topic has been created. For a list of editable topic settings, see Configuration Reference for Topics in Confluent Cloud.
- You cannot access internal Kafka topics, and therefore they cannot be edited. For example, the internal topic
__consumer_offsets
is not accessible. Also, topics that are not accessible do not count toward partition limits or partition billing charges. Topics created by managed connectors and ksqlDB are accessible.
The following steps describe how to edit a topic using the Cloud Console or Confluent CLI. Not all topic parameters can be edited. For more information, see topic parameters.
Follow these steps to update a topic with the Cloud Console:
Sign in to Confluent Cloud.
If you have more than one environment, select an environment.
Select a cluster.
Select Topics from the navigation menu. The Topics page appears.
Select the topic you want to modify.
Select the Configuration tab and Edit settings.
Make your changes and select Save changes. By default, only the most commonly modified settings are shown. For advanced settings, select Switch to expert mode.
Important
- You can’t use Cloud Console to modify parameters with a lock symbol () next to them.
- You can modify some parameters only after you create them. For more information, see: Configuration Reference for Topics in Confluent Cloud
Follow these steps to update a topic with the Confluent CLI:
Sign in to your Confluent Cloud account with the Confluent CLI. When prompted, enter a valid email and password for your Confluent Cloud account:
confluent login
Use the
confluent kafka topic update
command to change a topic. The following example changes the retention of a topic namedusers
in the clusterlkc-someID
:confluent kafka topic update users --cluster lkc-someID --config "retention.ms=172800000"
The output is similar to the following:
Updated the following configs for topic "users": Name | Value ----------------------+------------ retention.ms | 172800000
See the full list of options in the update command reference
To learn more about using the Confluent CLI with Confluent Cloud, see Connect the Confluent CLI to Confluent Cloud.
Delete topics¶
When you request to delete a topic, the topic is marked for deletion. The topic is not deleted immediately unless it is devoid of data, such as a newly created topic. In the interim, you cannot recreate a topic with the same name as the topic being deleted until the original topic and its data is finished being deleted.
When a topic is deleted, it cannot be restored.
Follow these steps to delete a topic using the Cloud Console:
- Sign in to Confluent Cloud.
- If you have more than one environment, select an environment.
- Select a cluster.
- Select Topics in the navigation menu. The Topics page appears.
- Choose the topic name link for the topic you want to delete, and then select the Configuration tab.
- Select *Delete topic.
- Confirm the topic deletion by typing the topic name and select Continue.
Follow these steps to delete a topic with the Confluent CLI:
Sign in to your Confluent Cloud account with the Confluent CLI. When prompted, enter a valid email and password for your Confluent Cloud account.
confluent login
Use the
confluent kafka topic delete
command to delete a topic. The following example requests the deletion of a topic namedusers
in the clusterlkc-someID
:confluent kafka topic delete users --cluster lkc-someID
The output is similar to the following:
Deleted topic "users".
See the full list of options in the delete command reference
To learn more about using the Confluent CLI with Confluent Cloud, see Connect the Confluent CLI to Confluent Cloud.
Follow these steps to delete a topic with the Confluent for VS Code extension.
In Confluent for VS Code, log in to Confluent Cloud.
If no topics are shown in the Topics pane, click Select Kafka cluster and select a cluster from the list.
Right-click on the topic you want to delete, and in the context menu, select Delete Topic.
The confirmation dialog opens.
In the confirmation dialog, type the name of the topic and press Enter.
The topic is deleted from the cluster, and the Topics pane updates to remove the topic.