How to Connect AWS Athena with Locale
A
Written by Aditi
Updated over a week ago

Athena is a serverless, interactive query service that makes it easy to analyze large amounts of structured and semi-structured data stored in Amazon S3 using standard SQL.
​
Here's how you can connect Athena with Locale:

Step 1: Get the Access Key and Secret Key

To connect Athena with Locale, you need to provide your AWS access key and Secret key.

Here's how you can get them:

  1. Sign in to the AWS Management Console.

  2. Open the IAM console.

  3. In the left navigation pane, choose Users.

  4. Choose or create an IAM user.

  5. Choose the Security credentials tab.

  6. In the Access keys section, choose to Create access key.

  7. Download the CSV file that contains your new access key and secret key.

πŸ’‘ It is recommended to create a new IAM user for Locale and give this user minimum required permissions.

Step 2: Set Up IAM Permissions

To create an IAM user with the right permission to use AWS Athena, you can either assign the predefined policy AWSQuicksightAthenaAccess or create a custom policy with more limited access.

Here's how to do it:

  1. Create an IAM permission policy.

  2. Choose the JSON tab.

  3. Enter the following policy:

{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"glue:SearchTables",
"athena:GetTableMetadata",
"athena:StartQueryExecution",
"athena:GetSession",
"glue:GetConnections",
"athena:ListDataCatalogs",
"glue:GetPartitions",
"athena:GetQueryResults",
"athena:GetDatabase",
"athena:GetDataCatalog",
"athena:GetQueryRuntimeStatistics",
"athena:ListQueryExecutions",
"glue:GetSchema",
"glue:GetConnection",
"glue:GetTrigger",
"glue:ListSchemas",
"glue:GetSchemaByDefinition",
"athena:GetQueryResultsStream",
"glue:GetTables",
"glue:GetTriggers",
"glue:GetDatabases",
"glue:ListJobs",
"glue:GetPartitionIndexes",
"athena:ListNamedQueries",
"glue:GetTable",
"glue:GetDatabase",
"athena:ListDatabases",
"athena:GetSessionStatus",
"athena:GetQueryExecution",
"athena:ListTableMetadata"
],
"Resource": "*"
},
{
"Sid": "VisualEditor1",
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Resource": "arn:aws:s3:::your-bucket-name"
}
]
}

Replace your-bucket-name in the policy JSON with the name of the bucket where you are going to store the output of Athena queries.

4. Attach the policy to the IAM user created in Step 1

5. Select the policy you want to attach, either your custom policy or predefined AWSQuicksightAthenaAccess policy.

πŸ’‘ If you are using AWSQuicksightAthenaAccess policy, attach an extra policy which has read access to the output s3 bucket.

Step 3: Configure Athena as a Data Connection

Perform the following steps to configure Athena as a data connection:

  1. Go to Add data connections and select Aws Athena Database.

2. Configure Athena as a data connection by entering the following details.

  • Datasource Name β†’ A unique name to identify the data source. You could have multiple AWS Athena databases connecting to Locale so you can use this name to uniquely differentiate between each of them within Locale’s platform.

  • AWS Region β†’ The AWS Region where Athena is hosted. For example us-east-1

  • Access Key β†’ IAM user access key which we created in Step 1.

  • Secret Key β†’ IAM user Secret key which we created in Step 1.

  • Output S3 bucket β†’ S3 bucket URI to store the output of Athena queries. For example s3://athena-output-bucket

3. Click on Test & Finish Setup and wait for it to be authenticated.

Congratulations πŸŽ‰, you've successfully added AWS Athena to Locale.

Happy Alerting!

Did this answer your question?