# Apache Kafka Destination Config Reference

<p><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/" >Apache Kafka</a> is a streaming destination. RudderStack publishes each event as a message to a topic on your Kafka cluster — as JSON, or serialized with Avro — keyed by the event&rsquo;s <code>userId</code>, or <code>anonymousId</code> when <code>userId</code> is absent, so one user&rsquo;s events stay in the same partition.</p>
<p>In an Apache Kafka destination spec:</p>
<ul>
<li><code>type: kafka</code></li>
<li><code>definition_version: 1</code></li>
</ul>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="sample-configuration">Sample configuration</h2><div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">version: rudder/v1
kind: destination
metadata:
  name: kafka-prod
spec:
  id: kafka-prod
  display_name: Kafka Production
  type: kafka
  definition_version: 1
  enabled: true
  config:
    host_name: &#34;{{ .KAFKA_HOST_NAME }}&#34;
    port: &#34;9093&#34;
    topic: rudder-events

    ssl_enabled: true
    use_sasl: true
    sasl_type: sha512
    username: &#34;{{ .KAFKA_USERNAME }}&#34;
    password: &#34;{{ .KAFKA_PASSWORD }}&#34;

    enable_multi_topic: true
    event_type_to_topic_map:
      - from: identify
        to: rudder-identifies
      - from: page
        to: rudder-pages
    event_to_topic_map:
      - from: Order Completed
        to: rudder-orders

    connection_mode:
      web: cloud
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - analytics</code></pre></div>
</div>
<p>The above example connects over SSL with SCRAM-SHA-512 authentication — see <a href="#ssl-and-sasl" >SSL and SASL</a>. It sends <code>identify</code> and <code>page</code> events and <code>Order Completed</code> to their own topics, and every other event to <code>topic</code> — see <a href="#topic-routing" >Topic routing</a>. It omits the Avro and SSH tunnel keys.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="config-keys">Config keys</h2><p><code>config</code> accepts only the keys listed below. The <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#config-key-rules" >shared config key rules</a> cover unknown keys, defaults, and immutability.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="connection">Connection</h3><div class="rs-ckeys">
<div class="rs-ckey" id="host_name">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">host_name</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Host name of your Kafka broker. To list several brokers, separate them with commas.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Each name consists of dot-separated labels of letters, digits, and hyphens, with no port and no scheme — <code>port</code> supplies the port.</li>
<li>Validation accepts a space after a comma, but RudderStack appends <code>:&lt;port&gt;</code> to each name exactly as written, so leave the spaces out.</li>
<li>Templates aren&rsquo;t accepted.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

<div class="rs-ckey" id="port">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">port</p>Required</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Port the brokers listen on. Every name in <code>host_name</code> uses it.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>A whole number from <code>1</code> to <code>65535</code>, written as a string. An unquoted number fails validation.</li>
<li>Templates aren&rsquo;t accepted.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">port: &#34;9093&#34;</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="topic">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">topic</p>Required</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Topic RudderStack publishes events to, unless an event is routed elsewhere — see <a href="#topic-routing" >Topic routing</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>1 to 249 characters: letters, digits, <code>.</code>, <code>_</code>, and <code>-</code>.</li>
<li>Templates aren&rsquo;t accepted.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="ssl-and-sasl">SSL and SASL</h3><p><code>ssl_enabled</code> and <code>use_sasl</code> decide which of the other keys here apply. SASL works only over SSL — RudderStack doesn&rsquo;t support SASL on a plaintext connection.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="ssl_enabled">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">ssl_enabled</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Connect to the brokers over SSL.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>The dashboard defaults this field to <code>true</code>. Rudder CLI doesn&rsquo;t fill it in, and RudderStack treats an omitted value as <code>false</code>, so write <code>ssl_enabled: true</code> to connect over SSL.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="ca_certificate">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">ca_certificate</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  PEM-encoded CA certificate RudderStack verifies the brokers&rsquo; certificates against. When it&rsquo;s omitted, RudderStack trusts the system&rsquo;s CAs, which is enough for brokers whose certificates chain to a public CA.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>ssl_enabled</code> is <code>true</code>. Leave it unset otherwise.</li>
<li>Not validated locally.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <p>Write it as a YAML block scalar to keep its line breaks:</p>
<div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">ca_certificate: |
  -----BEGIN CERTIFICATE-----
  MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ
  ...
  -----END CERTIFICATE-----  </code></pre></div>
</div>
<p>See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/#does-my-kafka-server-require-client-authentication" >Does my Kafka server require client authentication?</a> for two-way SSL.</p>

</div>

</div>

<div class="rs-ckey" id="use_sasl">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">use_sasl</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Authenticate to the brokers with SASL, using <code>sasl_type</code>, <code>username</code>, and <code>password</code>. The dashboard calls this <strong>Enable SASL with SSL</strong>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Takes effect only when <code>ssl_enabled</code> is <code>true</code>. With SSL off, RudderStack ignores it and connects without authenticating, and Rudder CLI doesn&rsquo;t require <code>username</code>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/#does-rudderstack-support-sasl_plaintext-authentication" >Does RudderStack support <code>SASL_PLAINTEXT</code> authentication?</a>.
</div>

</div>

<div class="rs-ckey" id="sasl_type">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">sasl_type</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>plain</code>
  </p>
<p class="rs-ckey__field">
  Description:
  SASL mechanism RudderStack authenticates with.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>One of <code>plain</code> (PLAIN), <code>sha256</code> (SCRAM-SHA-256), or <code>sha512</code> (SCRAM-SHA-512).</li>
<li>Applies when <code>ssl_enabled</code> and <code>use_sasl</code> are both <code>true</code>. Leave it unset otherwise.</li>
<li>Templates aren&rsquo;t accepted.</li>
</ul>

</div>

</div>

<div class="rs-ckey" id="username">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">username</p>RequiredSecret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  SASL username.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Required when <code>ssl_enabled</code> and <code>use_sasl</code> are both <code>true</code>. Leave it unset otherwise.</li>
<li>1 to 32 characters: letters, digits, <code>_</code>, and <code>-</code>.</li>
<li>Templates aren&rsquo;t accepted.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

<div class="rs-ckey" id="password">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">password</p>Secret</div>
  <p class="rs-ckey__field">
    Type:
    <code>string</code>
  </p>
<p class="rs-ckey__field">
  Description:
  SASL password for <code>username</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>ssl_enabled</code> and <code>use_sasl</code> are both <code>true</code>. Rudder CLI doesn&rsquo;t require it.</li>
<li>At most 100 characters, and must not contain line breaks.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  Supply it as a <code>{{ .VAR }}</code> reference rather than a literal — see <a href="#secrets" >Secrets</a>.
</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="topic-routing">Topic routing</h3><p>RudderStack picks each event&rsquo;s topic in this order:</p>
<ol>
<li>The topic the event names itself, in <code>integrations.Kafka.topic</code> — see <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/#sending-events-to-kafka-topics" >Sending events to Kafka topics</a>.</li>
<li>A matching entry in <code>event_type_to_topic_map</code> or <code>event_to_topic_map</code>, when <code>enable_multi_topic</code> is <code>true</code>.</li>
<li><code>topic</code>.</li>
</ol>
<div class="rs-ckeys">
<div class="rs-ckey" id="enable_multi_topic">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">enable_multi_topic</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p><p class="rs-ckey__field">
    Default value:
    <code>false</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Route events to topics by event type and <code>track</code> event name, using <code>event_type_to_topic_map</code> and <code>event_to_topic_map</code>. When <code>false</code>, RudderStack ignores both mappings.
</p>

</div>

<div class="rs-ckey" id="event_type_to_topic_map">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">event_type_to_topic_map</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps event types to topics. <code>track</code> events are routed by name instead, through <code>event_to_topic_map</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>enable_multi_topic</code> is <code>true</code>. Leave it unset otherwise.</li>
<li><code>from</code> — one of <code>identify</code>, <code>page</code>, <code>screen</code>, <code>group</code>, or <code>alias</code>. Templates aren&rsquo;t accepted.</li>
<li><code>to</code> — topic name. At most 100 characters, and must not contain line breaks. Unlike <code>topic</code>, its characters aren&rsquo;t checked. A <code>{{ path || fallback }}</code> template is accepted in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">event_type_to_topic_map:
  - from: identify
    to: rudder-identifies</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="event_to_topic_map">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">event_to_topic_map</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps <code>track</code> event names to topics.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>enable_multi_topic</code> is <code>true</code>. Leave it unset otherwise.</li>
<li><code>from</code> — <code>track</code> event name, matched exactly, including case. At most 100 characters, and must not contain line breaks.</li>
<li><code>to</code> — topic name, on the same terms as in <code>event_type_to_topic_map</code>.</li>
<li>Both fields accept a <code>{{ path || fallback }}</code> template in place of a literal.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">event_to_topic_map:
  - from: Order Completed
    to: rudder-orders</code></pre></div>
</div>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="avro-serialization">Avro serialization</h3><div class="rs-ckeys">
<div class="rs-ckey" id="convert_to_avro">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">convert_to_avro</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Serialize each event with Avro instead of publishing it as JSON. Each event selects its schema by ID, in <code>integrations.Kafka.schemaId</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>With this on, an event fails if it names no schema, names one that isn&rsquo;t in <code>avro_schemas</code>, or doesn&rsquo;t fit its schema. The schema has to cover every field the event carries.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  See <a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/#serializing-data-using-avro" >Serializing data using Avro</a> for a sample event and its schema.
</div>

</div>

<div class="rs-ckey" id="avro_schemas">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">avro_schemas</p>Required</div>
  <p class="rs-ckey__field">
    Type:
    <code>array of objects</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Avro schemas events can be serialized with.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Required when <code>convert_to_avro</code> is <code>true</code>. Leave it unset otherwise.</li>
<li><code>schema_id</code> — ID an event names to select the schema.</li>
<li><code>schema</code> — the Avro schema, as a JSON string.</li>
<li>Both fields are required in every entry, even when <code>convert_to_avro</code> is <code>false</code>, and neither is validated further locally.</li>
<li>A schema that doesn&rsquo;t parse stops delivery to this destination entirely, not just for the events that use it.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">convert_to_avro: true
avro_schemas:
  - schema_id: &#34;1&#34;
    schema: &#39;{&#34;type&#34;: &#34;record&#34;, &#34;name&#34;: &#34;RudderEvent&#34;, &#34;fields&#34;: [...]}&#39;</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="embed_avro_schema_id">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">embed_avro_schema_id</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Prefix each Avro message with its schema ID, in the format Confluent Schema Registry consumers expect: a zero byte, then the ID as a 4-byte integer.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Applies when <code>convert_to_avro</code> is <code>true</code>. Leave it unset otherwise.</li>
<li>Every <code>schema_id</code> must then be a whole number — an event using a non-numeric ID fails.</li>
</ul>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="ssh-tunnel">SSH tunnel</h3><p>Both keys below are internal: the dashboard offers no SSH settings for Kafka. Rudder CLI accepts them so that a destination already set up to connect through an SSH tunnel keeps that setup on update — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#some-keys-arent-in-the-dashboard" >Some keys aren&rsquo;t in the dashboard</a>.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="use_ssh">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">use_ssh</p>Internal</div>
  <p class="rs-ckey__field">
    Type:
    <code>boolean</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Connect to the brokers through an SSH tunnel via a bastion host.
</p>

</div>

<div class="rs-ckey" id="ssh">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">ssh</p>RequiredInternal</div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Bastion host connection details. RudderStack logs in with a private key it holds for this destination. <code>public_key</code> is the matching public key, which belongs in the bastion host&rsquo;s <code>authorized_keys</code>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>Required when <code>use_ssh</code> is <code>true</code>, with all four fields. Leave it unset otherwise.</li>
<li>A spec that sets <code>use_ssh: true</code> and omits any of the four fields fails validation.</li>
<li><code>host</code> — host name or IP address of the bastion host. Validation accepts a <code>host:port</code> form, but RudderStack appends <code>port</code> to this value, so leave the port out.</li>
<li><code>port</code> — SSH port of the bastion host, from <code>1</code> to <code>65535</code>, written as a string.</li>
<li><code>user</code> — user RudderStack logs in as. 1 to 32 characters: letters, digits, <code>_</code>, and <code>-</code>. <strong>Secret</strong> — see <a href="#secrets" >Secrets</a>.</li>
<li><code>public_key</code> — an <code>ssh-rsa</code>, <code>ssh-ed25519</code>, or <code>ssh-dss</code> public key, optionally followed by a <code>user@host</code> comment.</li>
<li>None of the four fields accepts a template.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">use_ssh: true
ssh:
  host: bastion.example.com
  port: &#34;22&#34;
  user: &#34;{{ .KAFKA_SSH_USER }}&#34;
  public_key: &#34;ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl rudderstack@bastion&#34;</code></pre></div>
</div>

</div>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h3 id="per-source-keys">Per-source keys</h3><p>Both keys are objects keyed by the local source type — the tokens listed under <a href="#source-types" >Source types</a>. A key naming a source type this destination doesn&rsquo;t support fails validation.</p>
<div class="rs-ckeys">
<div class="rs-ckey" id="connection_mode">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">connection_mode</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Maps each source type you connect to the mode its events reach Kafka in, using the modes in <a href="#source-types" >Source types</a>.
</p>

<div class="rs-ckey__notes">
  <p class="rs-ckey__field">Notes:</p>
  <ul>
<li>An entry is required for each source type you connect — see <a href="#connect-a-source" >Connect a source</a>.</li>
</ul>

</div>

<div class="rs-ckey__extra">
  <div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">connection_mode:
  web: cloud
  cloud: cloud</code></pre></div>
</div>

</div>

</div>

<div class="rs-ckey" id="consent_management">
  <div class="rs-ckey__title">
    <p class="rs-ckey__name">consent_management</p></div>
  <p class="rs-ckey__field">
    Type:
    <code>object</code>
  </p>
<p class="rs-ckey__field">
  Description:
  Consent provider configuration per source type. The entry shape, accepted providers, and the rules on <code>resolution_strategy</code> and <code>consents</code> are shared across all destination types — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#consent-management" >Consent management</a>.
</p>

</div>

</div>

<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="source-types">Source types</h2><p>Apache Kafka accepts events from these source types in the mentioned connection modes:</p>
<table>
  <thead>
      <tr>
          <th>Source type</th>
          <th>Connection mode</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><code>android</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>android_kotlin</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>ios_swift</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>web</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>unity</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cloud</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>react_native</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>flutter</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>cordova</code></td>
          <td><code>cloud</code></td>
      </tr>
      <tr>
          <td><code>warehouse</code></td>
          <td><code>cloud</code></td>
      </tr>
  </tbody>
</table>
<p>Every source type is <code>cloud</code> only — events reach Kafka from RudderStack&rsquo;s servers, never in device mode.</p>

<p><code>warehouse</code> is the token a <a href="https://www.rudderstack.com/docs/sources/reverse-etl/" >Reverse ETL source</a> resolves to. Rudder CLI manages the destination’s <code>warehouse</code> entry — if the destination is connected to a Reverse ETL source, set <code>connection_mode.warehouse: cloud</code> in its spec, or <code>apply</code> removes it.</p>
<p>Rudder CLI can also declare the Reverse ETL connection itself, for the types listed under <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-retl-connections/#supported-destinations" >Supported destinations</a> — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/retl-connections/" >Manage Reverse ETL Connections using Rudder CLI</a>.</p>

<html lang="en">
<blockquote class="info">
  <div class="tip-quote">
    
    <div class="tip-text">The dashboard additionally offers Apache Kafka to AMP and Shopify sources. Rudder CLI doesn&rsquo;t manage those connections, so <code>amp</code> and <code>shopify</code> are invalid here.</div>
  </div>
</blockquote>

</html>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="connect-a-source">Connect a source</h2><p>An event stream connection to this destination is checked against two rules at <code>validate</code> time.</p>
<p><strong>The source&rsquo;s type must be supported.</strong> A source&rsquo;s type resolves to one of the tokens above before the check — a JavaScript source resolves to <code>web</code>, and webhook and server-side SDK sources resolve to <code>cloud</code>. Every type an event stream source can resolve to is supported here, so this check always passes.</p>
<p><strong>The destination config must carry a <code>connection_mode</code> entry for that source type.</strong> This lives on the destination spec, not on the <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-connections/" >connection spec</a>. Without it:</p>
<div class="rs-code">
  <div class="rs-code__head"><button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-text" data-lang="text">destination &#39;kafka-prod&#39; config has no &#39;connection_mode&#39; entry for source type &#39;web&#39;</code></pre></div>
</div>
<p>Apache Kafka needs no additional config keys to connect a source of any type.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="secrets">Secrets</h2><p><code>host_name</code>, <code>username</code>, <code>password</code>, and <code>ssh.user</code> are the secret keys. <code>username</code> and <code>password</code> apply only when <code>ssl_enabled</code> and <code>use_sasl</code> are both <code>true</code>, and <code>ssh.user</code> only when <code>use_ssh</code> is <code>true</code>. Write each one you use as a <code>{{ .VAR }}</code> reference and supply the value at apply time:</p>
<div class="rs-code">
  <div class="rs-code__head">yaml<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-yaml" data-lang="yaml">config:
  host_name: &#34;{{ .KAFKA_HOST_NAME }}&#34;
  username: &#34;{{ .KAFKA_USERNAME }}&#34;
  password: &#34;{{ .KAFKA_PASSWORD }}&#34;</code></pre></div>
</div>
<div class="rs-code">
  <div class="rs-code__head">bash<button class="rs-code__copy" type="button">
      
      Copy
    </button>
  </div>
  <div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">export RUDDER_KAFKA_HOST_NAME=&#34;...&#34;
export RUDDER_KAFKA_USERNAME=&#34;...&#34;
export RUDDER_KAFKA_PASSWORD=&#34;...&#34;
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml</code></pre></div>
</div>
<p>Note that:</p>
<ul>
<li><code>rudder-cli import</code> writes only the secrets the API returns, as <code>{{ .VAR }}</code> references, and leaves the others out. Add any secret key it leaves out, then supply the variables before you apply — see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/#secrets" >Secrets</a>.</li>
<li><code>ca_certificate</code> and <code>ssh.public_key</code> aren&rsquo;t secrets — a CA certificate and a public key are public by design.</li>
</ul>
<p>See <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/variable-substitution/" >How to Use Variable Substitution in Rudder CLI</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="changes-by-release">Changes by release</h2>
<p>No changes since this type became available.</p>
<p>For changes across every destination type, see <a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/changes/" >Destination Type Changes by Release</a>.</p>
<!-- end-chunk -->
<!-- begin-chunk -->
<h2 id="see-more">See more</h2><ul>
<li><a href="https://www.rudderstack.com/docs/destinations/streaming-destinations/kafka/" >Apache Kafka Destination</a> for topic routing through the <code>integrations</code> object, Avro serialization, the partition key, and two-way SSL setup</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/confluent-cloud/" >Confluent Cloud Destination Config Reference</a> for a managed Kafka cluster on Confluent Cloud</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/destination-types/" >Destination Type Reference for Rudder CLI</a> for the rules shared across destination types</li>
<li><a href="https://www.rudderstack.com/docs/dev-tools/rudder-cli/yaml-destinations/" >Destination YAML Reference</a> for the spec envelope</li>
</ul>

