Manage Connections in Confluent Cloud for Apache Flink

A connection in Confluent Cloud for Apache Flink® represents an external service that is used in your Flink statements. Connections are used to access external services, such as databases, APIs, and other systems, from your Flink statements.

To create a connection, you need the OrganizationAdmin, EnvironmentAdmin, or FlinkAdmin RBAC role.

Confluent Cloud for Apache Flink makes a best-effort attempt to redact sensitive values from the CREATE CONNECTION and ALTER CONNECTION statements by masking the values for the known sensitive keys. In Confluent Cloud Console, the sensitive values are redacted in the Flink SQL workspace if you navigate away from the workspace and return, or if you reload the page in the browser. Alternatively, you can use the Confluent CLI commands to create and manage connections.

In addition, if syntax in the CREATE CONNECTION statement is incorrect, Confluent Cloud for Apache Flink may not detect the secrets. For example, if you type CREATE CONNECTION my_conn WITH ('ap-key' = 'x'), Flink won’t redact the x, because api-key is misspelled.

Note

Connection resources are an Open Preview feature in Confluent Cloud.

A Preview feature is a Confluent Cloud component that is being introduced to gain early feedback from developers. Preview features can be used for evaluation and non-production testing purposes or to provide feedback to Confluent. The warranty, SLA, and Support Services provisions of your agreement with Confluent do not apply to Preview features. Confluent may discontinue providing preview releases of the Preview features at any time in Confluent’s’ sole discretion.

Create a connection

  1. In the Confluent Cloud Console or in the Flink SQL shell, run the CREATE CONNECTION statement to create a connection.

    The following example creates an OpenAI connection with an API key.

    CREATE CONNECTION `my-connection`
      WITH (
        'type' = 'OPENAI',
        'endpoint' = 'https://<your-endpoint>.openai.azure.com/openai/deployments/<deployment-name>/chat/completions?api-version=2025-01-01-preview',
        'api-key' = '<your-api-key>'
      );
    

    The following example creates a MongoDB connection with basic authorization.

    CREATE CONNECTION `my-mongodb-connection`
      WITH (
        'type' = 'MONGODB',
        'endpoint' = 'mongodb+srv://myCluster.mongodb.net/myDatabase',
    
        'username' = '<atlas-user-name>',
        'password' = '<atlas-password>'
      );
    
  2. Run the CREATE TABLE statement to create a table that uses the connection.

    The following example creates a MongoDB external table that uses the MongoDB connection.

    -- Use the MongoDB connection to create a MongoDB external table.
    CREATE TABLE mongodb_movies_full_text_search (
        title STRING,
        plot STRING
    ) WITH (
        'connector' = 'mongodb',
        'mongodb.connection' = 'my-mongodb-connection',
        'mongodb.database' = 'sample_mflix',
        'mongodb.collection' = 'movies',
        'mongodb.index' = 'default'
    );
    

View details for a connection

In the Confluent Cloud Console or in the Flink SQL shell, run the DESCRIBE CONNECTION statement to get details about a connection.

DESCRIBE CONNECTION `my-connection`;

Your output should resemble:

+---------------+------------------------------------+
| Creation Date | 2025-08-13 22:04:57.972969         |
|               | +0000 UTC                          |
| Name          | azure-openai-connection            |
| Environment   | env-a1b2c3                         |
| Cloud         | aws                                |
| Region        | us-west-2                          |
| Type          | AZUREOPENAI                        |
| Endpoint      | https://<your-project-endpoint>    |
| Data          | <REDACTED>                         |
| Status        |                                    |
+---------------+------------------------------------+

List connections

In the Confluent Cloud Console or in the Flink SQL shell, run the SHOW CONNECTIONS statement to list the connections.

SHOW CONNECTIONS;

Your output should resemble:

                Creation Date          |           Name           | Environment | Cloud |  Region   |    Type     |            Endpoint             |    Data    | Status | Status Detail
---------------------------------+--------------------------+-------------+-------+-----------+-------------+---------------------------------+------------+--------+----------------
  2025-08-13 21:05:15.035376     | azureopenai-connection-2 | env-a1b2c3  | aws   | us-west-2 | AZUREOPENAI | https://<your-project-endpoint> | <REDACTED> |        |
  +0000 UTC                      |                          |             |       |           |             |                                 |            |        |
  2025-08-13 22:04:57.972969     | azure-openai-connection  | env-a1b2c3  | aws   | us-west-2 | AZUREOPENAI | https://<your-project-endpoint> | <REDACTED> |        |
  +0000 UTC                      |                          |             |       |           |             |                                 |            |        |

Update a connection

You can update only the credentials for a connection.

In the Confluent Cloud Console or in the Flink SQL shell, run the ALTER CONNECTION statement to update the connection.

ALTER CONNECTION `my-connection` SET ('api-key' = '<new-api-key>');

Your output should resemble:

+---------------+------------------------------------+
| Creation Date | 2025-08-13 22:04:57.972969         |
|               | +0000 UTC                          |
| Name          | azure-openai-connection            |
| Environment   | env-a1b2c3                         |
| Cloud         | aws                                |
| Region        | us-west-2                          |
| Type          | AZUREOPENAI                        |
| Endpoint      | https://<your-project-endpoint>    |
| Data          | <REDACTED>                         |
| Status        |                                    |
+---------------+------------------------------------+

Delete a connection

In the Confluent Cloud Console or in the Flink SQL shell, run the DROP CONNECTION statement to delete the connection.

DROP CONNECTION `my-connection`;