【问题标题】:Connect to AWS Athena with JDBC driver when AWS access is given through (Azure) OIDC provider当通过 (Azure) OIDC 提供商提供 AWS 访问权限时,使用 JDBC 驱动程序连接到 AWS Athena
【发布时间】:2019-11-28 11:40:22
【问题描述】:

我们通过公司提供给我们的 office365 用户连接到 AWS。由于我们在 UI 中扮演角色,我将如何从 DataGrip 之类的 JDBC 工具连接到 Athena?

【问题讨论】:

    标签: amazon-web-services jdbc openid-connect amazon-iam amazon-athena


    【解决方案1】:

    如果您想为 Athena 使用 JDBC,那么您可以使用如下所示的连接字符串以及您的访问密钥凭据作为用户名和密码。

    jdbc:awsathena://athena.{REGION}.amazonaws.com:443
    

    或者

    jdbc:awsathena://AwsRegion={REGION}
    

    请参阅thisthis,它们可以帮助您配置连接并从 DataGrip 运行查询。

    【讨论】:

      【解决方案2】:

      使用“com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain”。这个类试图从不同的提供者一个一个地加载凭证,直到它成功。

      有关 Simba athena 库的更多详细信息 - simba athena lib

      引用的示例代码:

          PoolConfiguration configuration = ((org.apache.tomcat.jdbc.pool.DataSource) dataSource).getPoolProperties();
          Properties properties = new Properties();
          properties.put("S3OutputLocation", "s3://bucket-name/folder/");
          properties.setProperty("AwsCredentialsProviderClass", "com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain");
          configuration.setDbProperties(properties);
          JdbcTemplate template =  new JdbcTemplate(dataSource);
      

      【讨论】:

        猜你喜欢
        • 2021-09-23
        • 2020-09-30
        • 1970-01-01
        • 1970-01-01
        • 2019-03-23
        • 2020-07-31
        • 2020-08-14
        • 1970-01-01
        • 2021-11-04
        相关资源
        最近更新 更多