<a id="cloud-topics-manage"></a>

<a id="cloud-topics"></a>

# Manage Topics in Confluent Cloud

An Apache Kafka® [topic](../_glossary.md#term-topic) in Confluent Cloud is a named stream that stores
event records. [Producers](../_glossary.md#term-producer) write data to topics, and
[consumers](../_glossary.md#term-consumer) read from them.

In Confluent Cloud, you can create and manage topics using the Confluent Cloud Console,
[Confluent CLI](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/topic/index.html),
[REST API](https://docs.confluent.io/cloud/current/ccloud/topic-v-3/),
or [Terraform](../clusters/terraform-provider.md#confluent-terraform-provider). Topics support
[schemas](../_glossary.md#term-schema) via Schema Registry, and topic settings such as retention,
partitions, and cleanup policy are configurable per cluster type. For
details about configuration settings, see [Manage Kafka Cluster Configuration Settings in Confluent Cloud](../clusters/broker-config.md#cloud-broker-config).

If you have more than 1,000 topics, the Cloud Console might not
display metrics for all topics. For complete monitoring, use the
Metrics API. For more information, see [Confluent Cloud Metrics](../monitoring/metrics-api.md#metrics-api).

<a id="access-topic"></a>

## Access topics

To access topics in Cloud Console:

1. Sign in to your Confluent Cloud account.
2. Select an environment and then a cluster.
3. From the navigation menu, select **Topics**.
4. Select a topic from the displayed list, or click **Create topic** to create a topic.

   Topics automatically include embedded [stream lineage visualizations](../stream-governance/stream-lineage.md#cloud-stream-lineage), as described in [Summary of navigation paths](../stream-governance/stream-lineage.md#stream-lineage-nav-path-summary).

#### 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 the Confluent Cloud Console with Private Networking](../networking/ccloud-console-access.md#ccloud-console-access-networking).

<a id="create-topics-cloud"></a>

## 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](../clusters/broker-config.md#cloud-broker-config).
Automatic topic creation is disabled by default in Confluent Cloud. To enable
it, see [Enable automatic topic creation](../clusters/broker-config.md#topic-creation).

If you have a Confluent for Kubernetes (CFK) deployment, you can declaratively create topics using CFK custom resource definitions (CRDs). For details, see [Create Kafka topics using CFK](https://docs.confluent.io/operator/current/co-manage-topics.html#create-ak-topic), and for example steps, see the [GitHub sample scenario](https://github.com/confluentinc/confluent-kubernetes-examples/tree/master/hybrid/ccloud-topic).

### Cloud Console

Follow these steps to create a topic with the Cloud Console:

1. Sign in to Confluent Cloud.
2. If you have more than one [environment](../security/access-control/hierarchy/cloud-environments.md#cloud-environments), select an environment.
3. Select a cluster.
4. Select **Topics** in the navigation menu. The **Topics** page appears.
5. Select **Create topic**.
   ![Create topic page Confluent Cloud](images/_topics/topics-empty-state.png)
6. Specify your topic details and click **Create with defaults**. For advanced topic
   settings, select **Customize settings**.
   ![Create topic with defaults page Confluent Cloud](images/_topics/new-topic-form.png)

   The new topic automatically includes an embedded [stream lineage visualization](../stream-governance/stream-lineage.md#cloud-stream-lineage), as described in [Summary of navigation paths](../stream-governance/stream-lineage.md#stream-lineage-nav-path-summary).

#### 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.

### Confluent CLI

Follow these steps to create a topic with the Confluent CLI:

1. Sign in to your Confluent Cloud account with the Confluent CLI. When prompted,
   enter a valid email and password for your Confluent Cloud account.
   ```none
   confluent login
   ```
2. Use the `confluent kafka topic create` command to create a topic.
   The following example creates a topic named `users` in the cluster `lkc-someID`:
   ```none
   confluent kafka topic create users --cluster lkc-someID
   ```

   The output is similar to the following:
   ```none
   Created topic "users".
   ```

#### NOTE
You can create a topic with Infinite Storage by specifying -1 for `retention.ms`.

```none
confluent kafka topic create users --cluster lkc-someID --config retention.ms=-1
```

See the full list of options in the
[command reference](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/topic/confluent_kafka_topic_create.html#confluent-kafka-topic-create) for `confluent kafka topic create`.

To learn more about using the Confluent CLI with Confluent Cloud,
see [Connect the Confluent CLI to Confluent Cloud](https://docs.confluent.io/confluent-cli/current/connect.html).

### Confluent for VS Code

Follow these steps to create a topic with the Confluent for VS Code extension.

1. Install [Confluent for VS Code for Confluent Cloud](../client-apps/vs-code-extension.md#cc-vscode-extension).
2. In Confluent for VS Code,
   [log in to Confluent Cloud](../client-apps/vs-code-extension.md#cc-vscode-extension-login).
3. If no topics are shown in the **Topics** pane, click
   **Select Kafka cluster** and select a cluster from the list.
4. In the **Topics** pane, hover over the **TOPICS** header to show the
   available commands and click **+**.

   The **Create a new topic** dialog opens.
5. Type the name of the new topic and press Enter.
6. Enter the partition count and press Enter.
7. Enter the replication count and press Enter.
8. The topic is created and displayed in the **Topics** pane. If you
   have many topics in the cluster, you might need to scroll to see it.

For more information, see [Confluent for VS Code for Confluent Cloud](../client-apps/vs-code-extension.md#cc-vscode-extension).

### Terraform

Create a topic by using the Confluent Terraform provider. For more
information, see [confluent_kafka_topic Resource](https://registry.terraform.io/providers/confluentinc/confluent/latest/docs/resources/confluent_kafka_topic).

<a id="edit-topics-cloud"></a>

## 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](manage.md#cloud-topic-config).
- You cannot access internal Kafka topics, and therefore they cannot be edited. For example, the [internal topic](../_glossary.md#term-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](manage.md#topic-parameters).

### Cloud Console

Follow these steps to update a topic with the Cloud Console:

1. Sign in to Confluent Cloud.
2. If you have more than one [environment](../security/access-control/hierarchy/cloud-environments.md#cloud-environments), select an environment.
3. Select a cluster.
4. Select **Topics** from the navigation menu. The **Topics** page appears.
5. Select the topic you want to modify.
   ![Topics page Confluent Cloud](images/_topics/topics-list-populated.png)
6. Select the **Configuration** tab and **Edit settings**.
   ![Edit topic settings access in Confluent Cloud](images/_topics/topic-configuration-view.png)
7. 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 (![lock](images/_topics/lock-icon.png)) next to them.
   - You can modify some parameters only after you create them. For more information, see [Configuration Reference for Topics in Confluent Cloud](manage.md#topic-parameters).

   ![Edit topic settings in Confluent Cloud](images/_topics/topic-configuration-basic-mode.png)

### Confluent CLI

Follow these steps to update a topic with the Confluent CLI:

1. Sign in to your Confluent Cloud account with the Confluent CLI. When prompted,
   enter a valid email and password for your Confluent Cloud account:
   ```none
   confluent login
   ```
2. Use the `confluent kafka topic update` command to change a topic.
   The following example changes the retention of a topic named `users`
   in the cluster `lkc-someID`:
   ```none
   confluent kafka topic update users --cluster lkc-someID --config "retention.ms=172800000"
   ```

   The output is similar to the following:
   ```none
   Updated the following configs for topic "users":
            Name         |   Value
   ============================-+================
          retention.ms   | 172800000
   ```

See the full list of options in the
[update command reference](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/topic/confluent_kafka_topic_update.html).

To learn more about using the Confluent CLI with Confluent Cloud,
see [Connect the Confluent CLI to Confluent Cloud](https://docs.confluent.io/confluent-cli/current/connect.html).

<a id="delete-topics-cloud"></a>

## Delete topics

<!-- c3 only at this time; uncomment when rbac enabled for cloud: .. note: If RBAC is enabled, you -->
<!-- must have permissions to delete a topic. Contact your RBAC system administrator. -->

When you request to delete a topic, the topic is marked for deletion.
The topic is not deleted immediately unless it has no data,
such as a newly created topic. You cannot recreate a topic with the same name
until Kafka finishes deleting the original topic and its data.

When a topic is deleted, it cannot be restored.

### Cloud Console

Follow these steps to delete a topic using the Cloud Console:
#. Sign in to Confluent Cloud.
#. If you have more than one [environment](../security/access-control/hierarchy/cloud-environments.md#cloud-environments), select an environment.
#. Select a cluster.
#. Select **Topics** in the navigation menu. The **Topics** page appears.
#. Select the topic name link for the topic you want to delete, and then select the **Settings** tab.
#. Select **Delete topic**.
#. Confirm the topic deletion by typing the topic name, and then select **Continue**.

### Confluent CLI

Follow these steps to delete a topic with the Confluent CLI:

1. 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
2. Use the `confluent kafka topic delete` command to delete a topic.
   The following example requests the deletion of a topic named `users`
   in the cluster `lkc-someID`:
   ```none
   confluent kafka topic delete users --cluster lkc-someID
   ```

   The output is similar to the following:
   ```none
   Deleted topic "users".
   ```

See the full list of options in the
[delete command reference](https://docs.confluent.io/confluent-cli/current/command-reference/kafka/topic/confluent_kafka_topic_delete.html).
To learn more about using the Confluent CLI with Confluent Cloud,
see [Connect the Confluent CLI to Confluent Cloud](https://docs.confluent.io/confluent-cli/current/connect.html).

### Confluent for VS Code

Follow these steps to delete a topic with the Confluent for VS Code extension.

1. Install [Confluent for VS Code for Confluent Cloud](../client-apps/vs-code-extension.md#cc-vscode-extension).
2. In Confluent for VS Code,
   [log in to Confluent Cloud](../client-apps/vs-code-extension.md#cc-vscode-extension-login).
3. If no topics are shown in the **Topics** pane, click
   **Select Kafka cluster** and select a cluster from the list.
4. Right-click the topic you want to delete, and in the context menu,
   select **Delete Topic**.

   The confirmation dialog opens.
5. 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.

## Related content

[Manage schemas](../sr/schemas-manage.md#cloud-schemas-manage)
: You can create schemas in Confluent Cloud and apply them to topics. Schemas let you
  specify the structure, type, and meaning of your data. You can define
  nuanced forward and backward compatibility requirements for schemas per topic to
  accommodate message data that evolves over time.

[View topic data in Stream Lineage](../stream-governance/stream-lineage.md#stream-lineage-tour)
: Use the Stream Lineage view to see which topics data flows to and
  from.

[Browse topic messages](messages.md#ccloud-topic-message-browser)
: View the data being produced to a topic. Browse message data, seek to a specific offset
  or timestamp by partition, and download selected messages.

[Share topics](../stream-sharing/index.md#cloud-data-sharing)
: You can share data at the topic level between multiple,
  separate organizations. An organization that shares data can
  package, price, and position the shared data as a product.
