doc/user/content/ingest-data/network-security/ssh-tunnel.md
{{< tabs >}} {{< tab "Cloud" >}} {{% network-security/ssh-tunnel %}} {{< /tab >}} {{< tab "Self-Managed" >}} {{% network-security/ssh-tunnel-sm %}} {{< /tab >}} {{< /tabs >}}
In Materialize, create a source connection that uses the SSH tunnel connection you configured in the previous section:
{{< tabs tabID="1" >}} {{< tab "Kafka">}}
CREATE CONNECTION kafka_connection TO KAFKA (
BROKER 'broker1:9092',
SSH TUNNEL ssh_connection
);
You can reuse this Kafka connection across multiple CREATE SOURCE statements.
{{< /tab >}} {{< tab "PostgreSQL">}}
CREATE SECRET pgpass AS '<POSTGRES_PASSWORD>';
CREATE CONNECTION pg_connection TO POSTGRES (
HOST 'instance.foo000.us-west-1.rds.amazonaws.com',
PORT 5432,
USER 'postgres',
PASSWORD SECRET pgpass,
SSL MODE 'require',
DATABASE 'postgres'
SSH TUNNEL ssh_connection
);
You can reuse this PostgreSQL connection across multiple CREATE SOURCE
statements:
CREATE SOURCE mz_source
FROM POSTGRES CONNECTION pg_connection (PUBLICATION 'mz_source')
FOR ALL TABLES;
{{< /tab >}}
{{< tab "MySQL">}}
CREATE SECRET mysqlpass AS '<POSTGRES_PASSWORD>';
CREATE CONNECTION mysql_connection TO MYSQL (
HOST '<host>',
SSH TUNNEL ssh_connection,
);
You can reuse this MySQL connection across multiple CREATE SOURCE
statements.
{{< /tab >}}
{{< /tabs >}}