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
@@ -283,19 +283,21 @@ SELECT count() FROM s3('https://datasets-documentation.s3.eu-west-3.amazonaws.co
283
283
284
284
## Role Assumption
285
285
286
-
ClickHouse supports assuming an AWS IAM role using a set of AWS credentials (`access_key_id`, `secret_access_key`, `session_token`).
287
-
This allows ClickHouse to obtain temporary credentials for accessing an S3 bucket, even if the original credentials do not have direct access.
286
+
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).
287
+
This allows ClickHouse to obtain temporary credentials for accessing an S3 bucket, even if the original credentials or instance do not have direct access.
288
288
289
289
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.
290
290
291
291
For more details on role assumption, read [AWS AssumeRole documentation](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).
292
292
293
-
To enable role assumption, pass parameters via the extra_credentials argument in the s3 function. The following keys are supported:
293
+
To use this mechanism, pass parameters via the `extra_credentials` argument to the `s3` function. The following keys are supported:
294
294
295
-
*`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.**
296
-
*`role_session_name` (optional) — Custom session name to include in the AssumeRole request.
295
+
*`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.**
296
+
*`role_session_name` (optional) — Custom session name to include in the AssumeRole request. If not specified, a random UUID will be assigned.
297
297
*`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.
298
298
299
+
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:
300
+
299
301
```sql
300
302
SELECTcount() FROM s3(
301
303
'<s3_bucket_uri>/*.csv',
@@ -309,6 +311,20 @@ SELECT count() FROM s3(
309
311
)
310
312
)
311
313
```
314
+
315
+
Otherwise, ClickHouse will attempt to extract credentials from EC2 metadata:
0 commit comments