This page provides a reference for AWS Athena actions available in the workflow automation actions catalog. Use these actions to run SQL queries against Amazon Athena, check their execution status, and retrieve results directly from a workflow definition.
Prerequisites
For prerequisites and credentials setup, see Set up AWS credentials.
Start a query execution
The action identifier is aws.athena.startQueryExecution.
Runs a SQL query against Amazon Athena and returns the query execution ID. This action does not wait for the query to complete — use aws.athena.getQueryExecution to poll for status and aws.athena.getQueryResults to retrieve results.
The following table describes the input fields for this action.
Input | Type | Description | Example |
|---|---|---|---|
| String | Required. AWS region of the Athena workgroup. |
|
| String | Required. The SQL statement to execute. Length: 1–262,144 characters. |
|
| String | Optional. IAM role ARN to assume for AWS API calls. |
|
| String | Optional. AWS access key ID. Pass as a secret. |
|
| String | Optional. AWS secret access key. Pass as a secret. |
|
| String | Optional. Temporary session token for STS authentication. Pass as a secret. |
|
| String | Optional. Athena database to run the query against. Length: 1–255 characters. |
|
| String | Optional. Data catalog name. Length: 1–256 characters. |
|
| String | Optional. S3 URI for query results. Required if the workgroup has no default output location. |
|
| String | Optional. Encryption for result files. Allowed values: |
|
| String | Optional. KMS key ARN or ID. Required when |
|
| String | Optional. 12-digit AWS account ID that must own the output S3 bucket. |
|
| String | Optional. Canned ACL applied to result objects. Allowed value: |
|
| String | Optional. Athena workgroup to run the query in. Defaults to |
|
| String | Optional. Idempotency token for retries. Length: 32–128 characters. |
|
| List | Optional. Parameter values for a parameterized query, applied in positional order. Each value: 1–1,024 characters. |
|
| Boolean | Optional. If |
|
| Integer | Optional. Maximum age in minutes of results that can be reused. Range: 0–10,080. |
|
| List | Optional. JQ selectors to extract specific fields from the action output. |
|
The following table describes the output fields for this action.
Output | Type | Example |
|---|---|---|
| Object |
|
| Boolean |
|
| String |
|
Example
name: start-athena-querydescription: Run a SQL query against Athenasteps: - name: startQuery type: action action: aws.athena.startQueryExecution version: '1' inputs: awsRoleArn: ${{ :secrets:awsRoleArn }} region: us-east-2 queryString: "SELECT * FROM my_table LIMIT 10" database: "my-database" catalog: "AwsDataCatalog" outputLocation: "s3://my-athena-results-bucket/path/" workGroup: "primary" selectors: - name: queryExecutionId expression: ".response.QueryExecutionId" next: endGet a query execution
The action identifier is aws.athena.getQueryExecution.
Returns the details and current status of a single Athena query execution by its execution ID. Use this to poll a query started by aws.athena.startQueryExecution until it reaches a terminal state (SUCCEEDED, FAILED, or CANCELLED).
The following table describes the input fields for this action.
Input | Type | Description | Example |
|---|---|---|---|
| String | Required. AWS region of the Athena workgroup. |
|
| String | Required. UUID of the query execution returned by |
|
| String | Optional. IAM role ARN to assume for AWS API calls. |
|
| String | Optional. AWS access key ID. Pass as a secret. |
|
| String | Optional. AWS secret access key. Pass as a secret. |
|
| String | Optional. Temporary session token for STS authentication. Pass as a secret. |
|
| List | Optional. JQ selectors to extract specific fields from the action output. |
|
The following table describes the output fields for this action.
Output | Type | Example |
|---|---|---|
| Object | Contains |
| Boolean |
|
| String |
|
Example
name: get-athena-query-executiondescription: Check the status of an Athena query executionsteps: - name: getExecution type: action action: aws.athena.getQueryExecution version: '1' inputs: awsRoleArn: ${{ :secrets:awsRoleArn }} region: us-east-2 queryExecutionId: "ef4a125f-9e79-466d-bae5-d6d36536fbee" selectors: - name: state expression: ".response.QueryExecution.Status.State" - name: stateChangeReason expression: ".response.QueryExecution.Status.StateChangeReason" next: endGet query results
The action identifier is aws.athena.getQueryResults.
Returns the rows and column metadata of a completed Athena query execution. Results are paginated — when the response includes a NextToken, pass it as nextToken on the next call to retrieve the following page. The first row of ResultSet.Rows is always the header row (column names).
The following table describes the input fields for this action.
Input | Type | Description | Example |
|---|---|---|---|
| String | Required. AWS region of the Athena workgroup. |
|
| String | Required. UUID of the completed query execution. Length: 1–128 characters. |
|
| String | Optional. IAM role ARN to assume for AWS API calls. |
|
| String | Optional. AWS access key ID. Pass as a secret. |
|
| String | Optional. AWS secret access key. Pass as a secret. |
|
| String | Optional. Temporary session token for STS authentication. Pass as a secret. |
|
| String | Optional. Pagination token from a previous truncated response. Omit to start from the first page. Length: 1–1,024 characters. |
|
| Integer | Optional. Maximum number of rows to return per page. Range: 1–1,000. |
|
| String | Optional. Result type to return. Allowed values: |
|
| List | Optional. JQ selectors to extract specific fields from the action output. |
|
The following table describes the output fields for this action.
Output | Type | Example |
|---|---|---|
| Object | Contains |
| Boolean |
|
| String |
|
Example
name: get-athena-query-resultsdescription: Fetch results of a completed Athena querysteps: - name: getResults type: action action: aws.athena.getQueryResults version: '1' inputs: awsRoleArn: ${{ :secrets:awsRoleArn }} region: us-east-2 queryExecutionId: "8d0105c1-30b5-4b8f-a23e-a1b60047c43f" maxResults: 100 selectors: - name: rows expression: ".response.ResultSet.Rows" - name: columnInfo expression: ".response.ResultSet.ResultSetMetadata.ColumnInfo" - name: nextToken expression: ".response.NextToken" next: end