Setup
Prerequisites in AWS
Before connecting Athena to ClarityQ, you need to set up the required AWS resources and permissions.Step 1: Create an IAM user for ClarityQ
- Go to the AWS Management Console
- Navigate to IAM → Users
- Click Create user
- Enter a descriptive name (e.g.,
clarityq-athena-user) - Click Next
Step 2: Assign permissions
Attach the following permissions to the IAM user. You can create a custom IAM policy with the minimum required permissions:Why does ClarityQ need
s3:PutObject if it only reads data?
Athena is a serverless query engine — it doesn’t store data itself. When you run a query, Athena reads
your data from S3, processes it, and writes the results to a separate S3 staging directory. The s3:PutObject
permission on the staging bucket is required by Athena for this results step. ClarityQ does not write to your
data buckets.- Replace
your-staging-bucketwith the S3 bucket for Athena query results. - Replace
your-data-bucketwith the S3 bucket(s) where your source data lives. If your data spans multiple buckets, add each one to theS3DataReadAccessstatement. - If you use AWS Lake Formation to manage data access, the
S3DataReadAccessstatement may not be needed — Lake Formation can grant table-level permissions independently of S3 IAM policies.
Optional: Restrict permissions to specific resources
Optional: Restrict permissions to specific resources
The policy above uses Glue — restrict to a specific database and its tables:Replace
"Resource": "*" for Athena and Glue, which grants access to all workgroups and databases.
For tighter security, you can scope permissions to specific resources by replacing "*" with resource ARNs.Athena — restrict to a single workgroup:<region>, <account-id>, <workgroup-name>, and <database-name> with your values.
The Glue catalog resource is required for any Glue API call to succeed.- In the IAM user creation flow, select Attach policies directly
- Click Create policy, paste the JSON above, and save it (e.g.,
ClarityQAthenaAccess) - Attach the newly created policy to the user
- Click Next then Create user
Step 3: Generate access keys
- Select the IAM user you just created
- Go to the Security credentials tab
- Under Access keys, click Create access key
- Select Third-party service as the use case
- Click Create access key
- Save both the Access Key ID and Secret Access Key — the secret key will not be shown again
Step 4: Set up the S3 staging directory
Athena requires an S3 location to store query results. If you don’t already have one:- Go to Amazon S3
- Click Create bucket
- Choose a name (e.g.,
clarityq-athena-results) and select the same region as your Athena workgroup - Keep the default settings (Block all public access enabled) and click Create bucket
Step 5: Verify your Athena workgroup
- Go to Amazon Athena
- Navigate to Workgroups in the left sidebar
- Note the workgroup name you want ClarityQ to use (default is
primary) - Ensure the workgroup’s State is Enabled
- If you scoped the IAM policy to a specific workgroup (see Restrict permissions to specific resources above), make sure the workgroup name matches the ARN in your policy
Configure connection in ClarityQ
In the ClarityQ interface, fill out the connection form with the following fields:Required Fields
- Connection Name: Choose a name for this connection (e.g., “Production Athena”)
- AWS Region: The AWS region where your Athena workgroup runs (e.g.,
us-east-1) - S3 Staging Directory: The S3 path for query results (e.g.,
s3://your-staging-bucket/athena-results/) - Database: The Athena database (Glue catalog database) to query (e.g.,
default). You can find your database name in the Athena Query Editor under the “Database” dropdown in the left sidebar - AWS Access Key ID: The access key ID generated in Step 3
- AWS Secret Access Key: The corresponding secret access key
Optional Fields
- Catalog: The data catalog name (defaults to
AwsDataCatalog— only change this if you use a custom or federated catalog) - Workgroup: The Athena workgroup to use (defaults to
primary)
Troubleshooting
Common connection issues
Access Denied on S3 staging directory- Ensure the IAM user has
s3:PutObjectands3:GetObjectpermissions on the staging bucket - Verify the S3 path includes a trailing slash (e.g.,
s3://bucket/prefix/) - Confirm the bucket is in the same region as your Athena workgroup
- Check that the database exists in the AWS Glue Data Catalog for the specified region
- Verify the catalog name is correct (use
AwsDataCatalogunless you have a custom catalog)
- Confirm the workgroup exists and is enabled in the Athena console
- Ensure the IAM user has
athena:GetWorkGrouppermission for the specified workgroup
- Double-check that the Access Key ID and Secret Access Key are correct
- Ensure the IAM user is active (not deactivated) in the AWS console
- If you rotated keys, update the credentials in ClarityQ