AWS 配置文件凭证
您可以通过设置以下连接参数来使用存储在 AWS 配置文件中的凭证。AWS 配置文件通常存储在 ~/.aws 目录的文件中。有关 AWS 配置文件的信息,请参阅《适用于 Java 的 AWS SDK Developer Guide》中的 Use profiles。
凭证提供程序
将用于对 AWS 的请求进行身份验证的凭证提供程序。将此参数的值设置为 ProfileCredentials。
| 参数名称 | 别名 | 参数类型 | 默认值 | 要使用的值 |
|---|---|---|---|---|
| CredentialsProvider | AWSCredentialsProviderClass(已弃用) | 必填 | none | ProfileCredentials |
配置文件名称
AWS 配置文件的名称,其凭证应该用于对 Athena 的请求进行身份验证。
| 参数名称 | 别名 | 参数类型 | 默认值 |
|---|---|---|---|
| ProfileName | none | 必填 | none |
注意
您也可以将配置文件名称指定为 CredentialsProviderArguments 参数的值,虽然这种用法已被弃用。
使用 IAM Identity Center 配置文件进行身份验证
使用带有 ProfileCredentials 提供程序的 IAM Identity Center 配置文件对发往 AWS 的请求进行身份验证。此方法使用 SSO 托管凭证代替长期访问密钥。以下示例显示了 ~/.aws/config 文件中所需的条目。
[profile athena-idc] sso_session = athena-idc-session sso_account_id = 111122223333 sso_role_name = AthenaQueryRole region = us-east-1 [sso-session athena-idc-session] sso_start_url = https://example.awsapps.com/start sso_region = us-east-1 sso_registration_scopes = sso:account:access
在打开 JDBC 连接之前,请先登录配置文件。例如,使用:aws sso login --profile athena-idc然后使用以下参数配置 JDBC 连接。
CredentialsProvider=ProfileCredentials; ProfileName=athena-idc;