Skip to main content

Amazon Athena ExecModule

Overview​

AwsAthenaModule reads the query execution history of an Amazon Athena workgroup and checks the state of a known execution. Use it to decide whether a report can proceed, flag executions that are still queued, or capture query timing and bytes scanned for operational review.

The connector signs requests to the regional Athena API. Its two operations read execution metadata. A separate step or application starts the queries you monitor.

Usage​

  1. Create a verified, READY Amazon Athena connection in the Integration Account Console.
  2. Add Amazon Athena in Workflow Studio and select the saved account under General > Connection.
  3. Set the AWS region. To discover executions, choose list_query_executions and enter a workgroup. To inspect an execution from an earlier step, choose get_query_execution and map its execution ID into the input.
  4. Branch on the connector status first. On a successful lookup, use data.state to decide whether to continue, wait, or route an exception.

Inputs​

InputTypeRequiredDefaultPurpose
operationstringYes—list_query_executions or get_query_execution.
regionstringYes—AWS region where the query runs, for example us-west-2.
workGroupstringFor listing—Exact workgroup name, 1–128 characters from A-Z, a-z, 0-9, period, underscore, and hyphen.
limitintegerNo25Maximum number of execution IDs per list page, from 1 through 50.
nextTokenstringNo—Opaque continuation token from the preceding list page, up to 1,024 characters.
queryExecutionIdstringFor lookup—Exact execution ID from Athena, 1–128 characters without whitespace or control characters.

Outputs​

OutputMeaning
status / operationConnector result (success or error) and the recognized operation.
items / countQuery execution ID strings in provider order and their count on this page.
hasMore / nextTokenWhether another page exists and the token to request it.
dataNormalized execution summary from get_query_execution.
requestIdAWS request ID when available.
errorStable error code, redacted message, retryability, and HTTP status when available.

A lookup returns queryExecutionId, workGroup, and state. The state is QUEUED, RUNNING, SUCCEEDED, FAILED, or CANCELLED. When Athena supplies them, submittedAt and completedAt are UTC ISO 8601 timestamps. dataScannedInBytes, engineExecutionTimeInMillis, and totalExecutionTimeInMillis are also optional. Treat an absent statistic as unknown. A successful connector call can report an execution in a failure state.

IntegrationAccount Requirements​

Use the Amazon Athena template with account name AWS. Enter the access key ID in the protected API key field and the secret access key in the protected password field. Verify the account and confirm it is READY. The workflow references the saved account, and the runtime credential broker resolves its key pair for request signing.

Grant athena:ListQueryExecutions for listing and athena:GetQueryExecution for exact lookup. Scope each action to the workgroups the workflow monitors, such as arn:aws:athena:us-west-2:123456789012:workgroup/warehouse.reports. Substitute the relevant AWS partition, region, account, and workgroup. These monitoring calls need no query submission, result retrieval, or S3 object permissions. See the Athena service authorization reference for workgroup scoping.

Configuration​

Select the saved AWS account and set the query's region. The module uses the standard regional Athena HTTPS endpoint. It accepts the saved access key pair. Custom endpoints, inline credentials, and session tokens are outside this connection contract.

Test the connection with a small page from an authorized workgroup. Keep execution IDs and timing in the workflow steps that need them. The summary omits SQL, execution parameters, result locations, and provider diagnostic text.

Operations​

  • list_query_executions calls ListQueryExecutions for one explicit workgroup and returns one page. If another page exists, reuse the returned token unchanged with the same AWS account, region, workgroup, and page size.
  • get_query_execution calls GetQueryExecution for one execution ID. Use it to check a known query directly or follow up on an ID returned by listing.

Errors and Failure Modes​

  • Invalid fields, unauthorized endpoint overrides, and unready or unverified connections fail before sending a request. Check the input for the selected operation and verify the saved connection.
  • If Athena rejects the request, confirm the account, region, execution ID, and permissions on the workgroup. Use the AWS request ID when available for correlation. A successful history page can contain zero executions.
  • Handle the retryability hint separately from Athena execution state. Throttling and temporary service failures can merit a bounded retry. A successful read of FAILED calls for investigation of that query.
  • Treat an invalid provider response separately from an empty page or an execution still in progress.

Example​

A reporting workflow already has an execution ID for a daily Athena query. Use a lookup before delivering the report.

{
"operation": "get_query_execution",
"region": "us-west-2",
"queryExecutionId": "e1d045ec-f539-4ce4-9d79-48eb6c01d640"
}

A completed execution can return the following summary.

{
"status": "success",
"operation": "get_query_execution",
"data": {
"queryExecutionId": "e1d045ec-f539-4ce4-9d79-48eb6c01d640",
"workGroup": "warehouse.reports",
"state": "SUCCEEDED",
"submittedAt": "2026-11-07T09:00:01Z",
"completedAt": "2026-11-07T09:00:04Z",
"dataScannedInBytes": 4194304,
"engineExecutionTimeInMillis": 2001,
"totalExecutionTimeInMillis": 3000
}
}

Allow report delivery on SUCCEEDED. For QUEUED or RUNNING, schedule a later lookup within your reporting window. Route FAILED or CANCELLED to the team that owns the query and include the execution ID. Use list_query_executions when you need to discover IDs for a workgroup, then look up selected IDs for state and statistics.

Notes​

  • Athena retains query history for 45 days. Limit the number of pages, executions, and total polling time in each workflow. Stagger calls across workgroups to reduce throttling.
  • Both operations are read-only and safe to repeat. Execution state and available history can change between requests. Use execution IDs to deduplicate observations before sending alerts.
  • Query submission, cancellation, result rows, and workgroup configuration are outside the connector's scope. Byte counts can identify executions worth reviewing for scan efficiency. They do not provide a billing total.