> ## Documentation Index
> Fetch the complete documentation index at: https://artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to your Managed Kafka cluster

> Connect Kafka clients to an Artie Managed Kafka cluster over TLS with SASL/SCRAM-SHA-512, using the bootstrap server and admin login from the Artie Dashboard.

## What you'll need

* A cluster that's **Ready**. See [Create a cluster](https://artie.com/docs/managed-kafka/create-a-cluster.md).
* Your app's IP address on the cluster's [IP allowlist](https://artie.com/docs/managed-kafka/manage.md#cluster-settings), if you turned on **Restrict access by IP**.

## Get the login

Open your cluster in the Artie Dashboard and go to the **Connect** tab.

| Field | Value |
| - | - |
| **Bootstrap server** | Your cluster's address, for example `mk-4f8k2q.use1-az1.kafka.aws.artie.so:9092`. |
| **Username** | `admin` |
| **Password** | Click **Show** to see it. |

![The Connect tab of a Managed Kafka cluster, showing the bootstrap server, the admin username, a hidden password, and the client config](https://mintcdn.com/artie/UZcMDJIwww2OXKYR/assets/managed-kafka/connect-tab.png?fit=max\&auto=format\&n=UZcMDJIwww2OXKYR\&q=85\&s=8a56e56ccd6efe2836c6162f4fe757b4)

Clients connect over TLS with SASL/SCRAM-SHA-512. The cluster uses a public TLS certificate, so you don't need a truststore.

## Connect a client

Replace the bootstrap server with your own and `<PASSWORD HERE>` with your cluster's password.

> [tab] Java / Kafka CLI
>
> Save this as `config.properties`:
>
> ```properties theme={null}
> bootstrap.servers=mk-4f8k2q.use1-az1.kafka.aws.artie.so:9092
> security.protocol=SASL_SSL
> sasl.mechanism=SCRAM-SHA-512
> sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required \
>   username="admin" password="<PASSWORD HERE>";
> ```
>
> Check that it works by sending a message:
>
> ```bash theme={null}
> kafka-console-producer.sh --bootstrap-server mk-4f8k2q.use1-az1.kafka.aws.artie.so:9092 \
>   --producer.config config.properties --topic orders
> ```
>
> Type a message and press Enter. If the command hangs or times out, check that your IP address is on the cluster's allowlist.

> [tab] Python
>
> Using [`kafka-python`](https://github.com/dpkp/kafka-python) 2.0 or later:
>
> ```python theme={null}
> from kafka import KafkaProducer
>
> producer = KafkaProducer(
>     bootstrap_servers="mk-4f8k2q.use1-az1.kafka.aws.artie.so:9092",
>     security_protocol="SASL_SSL",
>     sasl_mechanism="SCRAM-SHA-512",
>     sasl_plain_username="admin",
>     sasl_plain_password="<PASSWORD HERE>",
> )
> producer.send("orders", b"hello")
> producer.flush()
> ```

Topics are created automatically the first time a client writes to them, with 14 days of retention. To set partitions or retention up front, [create the topic](https://artie.com/docs/managed-kafka/manage.md#topics) first.

## Advanced

> [accordion] Which ports do clients use?
>
> Clients connect to the bootstrap server on port 9092. Each broker also gets its own port, from 9093 up to 9092 plus your broker count, so 9092 to 9095 for 3 brokers and at most 9092 to 9122. Allow outbound traffic to the whole range, not only 9092, and widen it before you add brokers.

> [accordion] My client stopped connecting after a password change
>
> Generating a new password stops the old one working as soon as the new one is ready. Copy the new password from the **Connect** tab and update every client. See [Generate a new password](https://artie.com/docs/managed-kafka/manage.md#generate-a-new-password).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.