SHOW CREATE EXTERNAL CONNECTION

On this page Carat arrow pointing down
Warning:
GA releases for CockroachDB v23.1 are no longer supported. Cockroach Labs will stop providing LTS Assistance Support for v23.1 LTS releases on November 13, 2025. Prior to that date, upgrade to a more recent version to continue receiving support. For more details, refer to the Release Support Policy.

You can use external connections to specify and interact with resources that are external from CockroachDB. When creating an external connection, you define a name for an external connection while passing the provider URI and query parameters. SHOW CREATE EXTERNAL CONNECTION displays the connection name and the creation statements for active external connections.

You can also use the following SQL statements to work with external connections:

Required privileges

Without the admin role, users can only view the external connections that they own. Users own external connections that they have created with CREATE EXTERNAL CONNECTION.

Users with the admin role can view all external connections with SHOW CREATE EXTERNAL CONNECTION.

Synopsis

SHOW CREATE ALL EXTERNAL CONNECTIONS EXTERNAL CONNECTION connection_name

Parameters

Parameter Description
connection_name The name of the external connection to pass in operation statements.

Examples

Show all external connection create statements

icon/buttons/copy
SHOW CREATE ALL EXTERNAL CONNECTIONS;

This will return a list of of active external connection names along with the CREATE EXTERNAL CONNECTION statements that were used to create them, including the unredacted URI:

  connection_name |                                                                              create_statement
------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
backup_bucket_1   | CREATE EXTERNAL CONNECTION 'backup_bucket' AS 's3://bucket_name?AWS_ACCESS_KEY_ID={access key}&AWS_SECRET_ACCESS_KEY={secret access key}'
backup_bucket_2   | CREATE EXTERNAL CONNECTION 'backup_bucket_2' AS 's3://bucket_name?AWS_ACCESS_KEY_ID={access key}&AWS_SECRET_ACCESS_KEY={secret access key}'
kafka             | CREATE EXTERNAL CONNECTION 'kafka' AS 'kafka://broker.address.com:9092?topic_prefix=bar_&tls_enabled=true&ca_cert={certificate}&sasl_enabled=true&sasl_user={sasl user}&sasl_password={url-encoded password}&sasl_mechanism=SCRAM-SHA-256'
(4 rows)

Show an external connection create statement

To display the CREATE statement for a specific external connection, pass the name of the connection similar to the following:

icon/buttons/copy
SHOW CREATE EXTERNAL CONNECTION backup_bucket_1;
connection_name   |                                                         create_statement
------------------+-------------------------------------------------------------------------------------------------------------------------------------------
backup_bucket_1   | CREATE EXTERNAL CONNECTION 'backup_bucket' AS 's3://bucket_name?AWS_ACCESS_KEY_ID={access key}&AWS_SECRET_ACCESS_KEY={secret access key}'

See also


Yes No
On this page

Yes No