Skip to main content

Amazon Athena Query Workflow Step


Amazon Athena Query Workflow Step

Available in PagerDuty Process Automation Commercial products.

About Amazon Athena

Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL.

Athena is out-of-the-box integrated with AWS Glue Data Catalog, allowing users to create a unified metadata repository across various services, crawl data sources to discover schemas and populate their Catalog with new and modified table and partition definitions, and maintain schema versioning.

To learn more about Amazon Athena, click hereopen in new window.

About the Amazon Athena Query Workflow Step Plugin

The Athena Query Workflow Step plugin allows users to make queries through Athena to their S3 data as part of their automated-runbook workflows:

Configuration

Before queries can be made through Athena, data must be made available in S3. For documentation on connecting to data sources, click hereopen in new window

Once Athena has been connected with a data source, it is recommended by AWS to start with the AWS Managed Policies for Athena. These can be found hereopen in new window. Permissions can then be modified to suit the specific use-case for Process Automation.

Authentication

Follow the instructions outlined in the AWS Plugins Overviewopen in new window for Process Automation to authenticate with AWS.

When defining the IAM Role for Runbook Automation or Process Automation, be sure to include the following permissions in the Policy associated with the role:

  • athena:StartQueryExecution
  • athena:getQueryExecution
  • athena:getQueryResults

Job Step Configuration

  1. In a new or existing Job, click on Add a step.

  2. In the Workflow Steps tab, search for and select AWS / Athena / Query.

  3. Insert the SQL Query for Athena into the Query field.

  4. Provide the Athena database into the Database Field.

  5. Provide the S3 Bucket for the results of the SQL query into the Bucket field.

  6. Select the Region where the Athena client and database resides.

  7. Optionally provide the Access Key ID and Secret Key to set the AWS credential on a per Job basis - rather than at the Project or System levels.


Viewing Query Results

When a query to Athena is made through Process Automation, the first 50 rows of results from that query are visible in the Log Output of the Job execution:

To view the full log output of the Athena query, navigate to the link provided in the log-output.