Accessing Amazon Athena over JDBC with an IAM role

0

I have an analytics application running on EC2. The application uses the Athena JDBC connector to connect to Athena and run queries. Can I use an IAM role attached to the EC2 instance to authorize the Athena connection, rather than embedding credentials in the JDBC connection string?

AWS
已提问 4 年前1996 查看次数
1 回答
0
已接受的回答

It is indeed a best practice to use an IAM role rather than embedding credentials in the JDBC connection string. Attach the AWSQuicksightAthenaAccess Managed Policy to the IAM role used in the EC2 instance profile. Then specify the DefaultAWSCredentialsProviderChain in the JDBC connection string. The JDBC connection string would look like this:

jdbc:awsathena://AwsRegion=<aws-region>;S3OutputLocation=s3://<s3_bucket>/;AwsCredentialsProviderClass=com.simba.athena.amazonaws.auth.DefaultAWSCredentialsProviderChain

Read more here on Using Athena with the JDBC Driver.

AWS
Kunal_G
已回答 4 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则