How to connect JDBC connector to AWS Athena Federated queries?

Viewed 1352

I want to query Aurora MySQL database from Athena using Federated queries.

As I understand I need to find JDBC connector in Serverless Application Repository service and then follow this guide.

I've managed to set up the lambda function:

Runtime settings com.amazonaws.connectors.athena.jdbc.MultiplexingJdbcCompositeHandler

Environment variables:

aurora_connection_string    mysql://jdbc:mysql://auroradb-databasecluster-####.us-east-1.rds.amazonaws.com:3306?user=####&password=####
default mysql://jdbc:mysql://auroradb-databasecluster-####.us-east-1.rds.amazonaws.com:3306?user=####&password=####
disable_spill_encryption    false
spill_bucket    athena-federation-spill-ips
spill_prefix    athena-spill

For the subnets and security group I've added same 2 subnets and security group that is added to my database cluster. It automatically has found correct VPN.

When I added this lambda function as my data source in Athena it is available as source but upon picking it just starts infinite loading of databases and tables. No error message. Only browser complaining that page has become unresponsive.

Most documentations and guides still refer to using AmazonAthenaPreviewFunctionality which is from time ago when Federated queries where in preview. So it's not clear to me if the guide in github is actually up to date.

Could this be a problem with security group setup? We have ingress rules allowing specific IP traffic only (but I did add a temporal rule to allow all and nothing changed)

Where/how can I get detailed error message? Prior to this issue there we all sorts of error in Athena console that were helpful for improving the lambda function setup.

Any help will be much appreciated!

3 Answers

In my case the problem was, the lambda couldn't connect to the spill bucket. To resolve the issue, create a private VPC endpoint to S3 and add the endpoint to the bucket policy.

Looks like from ur connection_string config the DB schema is missing.

You can refer to CloudWatch logs.

Related