You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/en/sql-reference/10-sql-commands/00-ddl/13-connection/create-connection.md
+66-3Lines changed: 66 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -8,22 +8,64 @@ import FunctionDescription from '@site/src/components/FunctionDescription';
8
8
9
9
Creates a connection to external storage.
10
10
11
+
:::warning
12
+
IMPORTANT: When objects (stages, tables, etc.) use a connection, they copy and store the connection's parameters permanently. If you later modify the connection using CREATE OR REPLACE CONNECTION, existing objects will continue using the old parameters. To update objects with new connection parameters, you must drop and recreate those objects.
13
+
:::
14
+
11
15
## Syntax
12
16
13
17
```sql
14
18
CREATE [ OR REPLACE ] CONNECTION [ IF NOT EXISTS ] <connection_name>
| STORAGE_TYPE | Type of storage service. Possible values include: `s3`, `azblob`, `gcs`, `oss`, and `cos`. |
23
-
| storage_params | Vary based on storage type and authentication method. See [Connection Parameters](../../../00-sql-reference/51-connect-parameters.md) for details. |
26
+
| storage_params | Vary based on storage type and authentication method. See details below for common authentication methods. |
27
+
28
+
For other storage types and additional parameters, see [Connection Parameters](../../../00-sql-reference/51-connect-parameters.md) for details.
29
+
30
+
### Authentication Methods for Amazon S3
31
+
32
+
Databend supports two primary authentication methods for Amazon S3 connections:
33
+
34
+
#### 1. Access Keys Authentication
35
+
36
+
Use AWS access keys for authentication. This is the traditional method using an access key ID and secret access key.
37
+
38
+
```sql
39
+
CREATE CONNECTION <connection_name>
40
+
STORAGE_TYPE ='s3'
41
+
ACCESS_KEY_ID ='<your-access-key-id>'
42
+
SECRET_ACCESS_KEY ='<your-secret-access-key>';
43
+
```
44
+
45
+
| Parameter | Description |
46
+
|-----------|-------------|
47
+
| ACCESS_KEY_ID | Your AWS access key ID. |
48
+
| SECRET_ACCESS_KEY | Your AWS secret access key. |
49
+
50
+
#### 2. IAM Role Authentication
51
+
52
+
Use AWS IAM roles for authentication instead of access keys. This provides a more secure way to access your S3 buckets without managing credentials directly in Databend.
53
+
54
+
```sql
55
+
CREATE CONNECTION <connection_name>
56
+
STORAGE_TYPE ='s3'
57
+
ROLE_ARN ='<your-role-arn>';
58
+
```
59
+
60
+
| Parameter | Description |
61
+
|-----------|-------------|
62
+
| ROLE_ARN | The Amazon Resource Name (ARN) of the IAM role that Databend will assume to access your S3 resources. |
63
+
24
64
25
65
## Examples
26
66
67
+
### Using Access Keys
68
+
27
69
This example creates a connection to Amazon S3 named 'toronto' and establishes an external stage named 'my_s3_stage' linked to the 's3://databend-toronto' URL, using the 'toronto' connection. For more practical examples about connection, see [Usage Examples](index.md#usage-examples).
28
70
29
71
```sql
@@ -35,4 +77,25 @@ CREATE CONNECTION toronto
35
77
CREATE STAGE my_s3_stage
36
78
URL ='s3://databend-toronto'
37
79
CONNECTION = (CONNECTION_NAME ='toronto');
38
-
```
80
+
```
81
+
82
+
### Using AWS IAM Role
83
+
84
+
This example creates a connection to Amazon S3 using an IAM role and then creates a stage that uses this connection. This approach is more secure as it doesn't require storing access keys in Databend.
To use IAM roles with Databend Cloud, you need to set up a trust relationship between your AWS account and Databend Cloud. See [Creating External Stage with AWS IAM Role](/guides/load-data/stage/aws-iam-role) for detailed instructions.
0 commit comments