Search code examples
amazon-web-servicesamazon-athena

Is there a way to batch delete AWS Athena queries


We had a scheduled AWS Lambda job that went out and ran an Athena query daily and inserted that data into a 3rd party utility.

This utility is no longer in use and the lambda job has been deleted but there are still a lot of the Athena queries that were run showing up in our Saved Queries list. Is there a way to batch delete these queries other than writing a utility to do it as going into Athena and selecting each one for deletion is very time consuming and ends up not being done.


Solution

  • You could write a script that calls ListNamedQueries, then loops through them and calls DeleteNamedQuery.

    This could be done with the AWS CLI or any AWS SDK.