I need to create alerts based on the results returned by queries in Amazon Athena

Viewed 1646

I need to create alerts based on the results returned by queries in Amazon Athena. I don't see how I can do that now.

For example -

  1. Schedule a query to be executed once an hour (I am not aware of a way to do this now)
  2. Based on the results of the query (for example I would be checking the number of transactions the last hour), I might need to send an alert to someone that something may be wrong (number of transactions is too low).

I know this is different but I would do something similar, in SQL Server, using a SQL Server Agent job.

1 Answers

There is no in-built capability to run Amazon Athena queries on a schedule and send notifications. However, you could configure this using AWS services.

I would recommend:

  • Create an Amazon SNS topic that will receive notifications
    • Subscribe recipients to the SNS topic (eg via email, SMS)
  • Create an Amazon CloudWatch Event that triggers on a cron schedule
  • Configure the Event to trigger an AWS Lambda function
  • Write code for the AWS Lambda function to:
    • Run an Amazon Athena query
    • Compare the result to desired values
    • If the result is outside desired values, send a message to the Amazon SNS Topic
Related