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

# Managed Kafka

> Reach a Managed Kafka cluster with bqto Pro, through a SOCKS5 proxy on the bastion and a local kafka-proxy that does the TLS.

> [!NOTE]
>
> This needs bqto Pro.

## Connect

```sh theme={null}
bqto connect --service kafka --project my-project --instance europe-west1/my-cluster
```

`--instance` takes the region and the cluster name, as `REGION/NAME`.

A connection to Managed Kafka goes through the SOCKS5 proxy on the bastion and through a local
`kafka-proxy`. `kafka-proxy` does the TLS, and you run it on your machine.

The ready line shows two things: the local port that bqto set aside for `kafka-proxy`, and the
`kafka-proxy` command to run.

## In scripts

With `-- CMD`, the command gets these variables:

| Variable | Value |
| - | - |
| `BQTO_REMOTE` | What to reach through the SOCKS proxy, `HOST:PORT` |
| `BQTO_KAFKA_PROXY_PORT` | The local port that bqto set aside for `kafka-proxy`, as the ready line shows |
| `BQTO_TLS` | Empty, because `kafka-proxy` does the TLS |
| `BQTO_AUTH` | `sasl`, through `kafka-proxy` |

With `--output json`, the ready event has the local `kafka-proxy` port.

The access token that your client uses travels in cleartext only to `kafka-proxy` on `127.0.0.1`.
`kafka-proxy` sends it to the cluster over TLS.

## What it needs

* The role `roles/managedkafka.viewer` in the service project, together with the roles that every
  session needs. See [Permissions](https://docs.bqto.dev/reference/permissions.md).


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