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/table-functions/s3.md
+21-5Lines changed: 21 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -272,19 +272,21 @@ SELECT count() FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.co
272
272
273
273
## Role Assumption
274
274
275
-
ClickHouse supports assuming an AWS IAM role using a set of AWS credentials (`access_key_id`, `secret_access_key`, `session_token`).
276
-
This allows ClickHouse to obtain temporary credentials for accessing an S3 bucket, even if the original credentials do not have direct access.
275
+
ClickHouse supports assuming an AWS IAM role using a set of AWS credentials (`access_key_id`, `secret_access_key`, `session_token`) or EC2 metadata (only when running on EC2 instance).
276
+
This allows ClickHouse to obtain temporary credentials for accessing an S3 bucket, even if the original credentials or instance do not have direct access.
277
277
278
278
For example, if the provided credentials have permission to assume a role but lack direct access to the S3 bucket, ClickHouse will first request temporary credentials from AWS STS and then use those credentials to access S3.
279
279
280
280
For more details on role assumption, read [AWS AssumeRole documentation](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).
281
281
282
-
To enable role assumption, pass parameters via the extra_credentials argument in the s3 function. The following keys are supported:
282
+
To use this mechanism, pass parameters via the `extra_credentials` argument to the `s3` function. The following keys are supported:
283
283
284
-
*`role_arn` (required) — ARN of the IAM role to assume. **If this key is not provided, ClickHouse will not attempt to assume a role and will use the original credentials as-is.**
285
-
*`role_session_name` (optional) — Custom session name to include in the AssumeRole request.
284
+
*`role_arn` (required) — ARN of the IAM role to assume. **If this key is not provided, ClickHouse will not attempt to assume a role and will try to access the bucket as-is.**
285
+
*`role_session_name` (optional) — Custom session name to include in the AssumeRole request. If not specified, a random UUID will be assigned.
286
286
*`sts_endpoint_override` (optional) — Overrides the default AWS STS endpoint (https://sts.amazonaws.com). Useful for testing with a mock or when using another STS-compatible service.
287
287
288
+
If explicit `access_key_id` and `secret_access_key` are provided as parameters to `s3(...)` function, then they will be used for retrieving temporary credentials from STS:
289
+
288
290
```sql
289
291
SELECTcount() FROM s3(
290
292
'<s3_bucket_uri>/*.csv',
@@ -298,6 +300,20 @@ SELECT count() FROM s3(
298
300
)
299
301
)
300
302
```
303
+
304
+
Otherwise, ClickHouse will attempt to extract credentials from EC2 metadata:
0 commit comments