Create, Edit, and Delete Topics in Confluent Cloud¶
This page provides the steps to create, edit, and delete Apache Kafka® topics in Confluent Cloud using the Cloud Console or the Confluent CLI. You can also list, create or delete topics with REST APIs.
The topics are grouped by cluster within each environment.
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 Access Confluent Cloud Console with Private Networking for details.
Create a Topic¶
The following steps describe how to create a topic using the Cloud Console or Confluent CLI.
To see a list of the default, maximum, and minimum Kafka configuration settings in Confluent Cloud, see Manage Kafka Cluster and Topic Configuration Settings in Confluent Cloud.
Follow these steps to create a topic with the Cloud Console:
If you have more than one environment, select an environment.
Select a cluster.
Click the Topics in the navigation menu. The Topics page appears.
If there aren’t any topics created yet, click Create topic. Otherwise, click Add a topic.
Specify your topic details and click Create with defaults. For advanced topic settings, click Customize settings.
Note
To create a topic with infinite storage, on the New Topic page, click
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.
Edit a Topic¶
The following steps describe how to edit a topic using the Cloud Console or Confluent CLI. Not all topic parameters can be edited. See topic parameters for a list of parameters.
Follow these steps to update a topic with the Cloud Console:
If you have more than one environment, select an environment.
Select a cluster.
Click the Topics from the navigation menu. The Topics page appears.
Select the topic name link for the topic you want to modify.
Select the Configuration tab and Edit settings.
Make your changes and click Save changes. By default, only the most commonly modified settings are shown. For advanced settings, click Switch to expert mode.
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 similiar 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.
Editable topic parameters¶
The following table lists default parameter values for custom topics. The table also includes minimum and maximum values where they are relevant, and whether the parameters are editable. To edit topic settings, see Edit a Topic.
Important
The following limitations apply to changing parameter values after a topic has been created:
- The
num.partitions
value can only be increased and not decreased after a topic is created, and you must make the increase using the CLI or API. - All other editable settings can be changed after topic creation, but the limits that applied at topic creation still apply.
Parameter Name | Default | Editable | More Info |
---|---|---|---|
cleanup.policy | delete | Yes | See footnote [*] |
compression.type | producer | No | |
connection.failed.authentication.delay.ms | 5000 | No | |
default.replication.factor | 3 | No | |
delete.retention.ms | 86400000 | Yes | Max: 63113904000 |
file.delete.delay.ms | 60000 | No | |
flush.messages | 9223372036854775807 | No | |
flush.ms | 9223372036854775807 | No | |
group.max.session.timeout.ms | 1200000 | No | |
index.interval.bytes | 4096 | No | |
max.message.bytes (Dedicated) | 2097164 | Yes | Max: 20971520 |
max.message.bytes (Standard, Basic) | 2097164 | Yes | Max: 8388608 |
max.compaction.lag.ms | 9223372036854775807 | Yes | Min: 604800000 (7 days) |
message.downconversion.enable | true | No | |
message.format.version | 3.0-IV1 | No | |
message.timestamp.difference.max.ms | 9223372036854775807 | Yes | |
message.timestamp.type | CreateTime | Yes | |
min.cleanable.dirty.ratio | 0.5 | No | |
min.compaction.lag.ms | 0 | Yes | |
min.insync.replicas | 2 | Yes | |
num.partitions | 6 | Yes, see Custom topic settings for all cluster types supported by Kafka REST API and Terraform Provider | Limits vary, see: Confluent Cloud Cluster Types |
offsets.retention.minutes | 10080 | No | |
preallocate | false | No | |
retention.bytes | -1 | Yes | |
retention.ms | 604800000 | Yes | Set to -1 for infinite storage |
segment.bytes | 104857600 | Yes | Min: 52428800 Max: 1073741824 (1 gibibyte) |
segment.index.bytes | 10485760 | No | |
segment.jitter.ms | 0 | No | |
segment.ms | 604800000 | Yes | Min: 14000000 (4 hours) [†] |
unclean.leader.election.enable | false | No |
[*] | You cannot directly change cleanup.policy from delete to compact, delete . To set cleanup.policy to compact, delete , you must first change from delete to compact , then change to compact, delete . |
[†] | You can set segment.ms to as low as 600000 (10 minutes) but the minimum 14000000 (4 hours) is still enforced. |
Delete a Topic¶
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:
- If you have more than one environment, select an environment.
- Select a cluster.
- Click the 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.
- Click *Delete topic.
- Confirm the topic deletion by typing the topic name and click 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 similiar 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.