Orchestrating Long-Running Athena Queries Cost-Effectively
A data engineer must orchestrate a series of Amazon Athena queries that will run every day. Each query can run for more than 15 minutes. Which combination of steps will meet these requirements MOST cost-effectively? (Choose two.)
Community Votes
80% of anonymous learners picked answer AB. Votes are pick records left by other test-takers — they are not the verified answer.
Community Insight
The core trap is assuming Lambda's 15-minute timeout prevents it from triggering long-running queries; in reality, Lambda only initiates the asynchronous execution, while Step Functions handles the polling and orchestration.
This question addresses the most cost-effective method to orchestrate a series of Amazon Athena queries that exceed the 15-minute limit. The correct solution leverages AWS Lambda for invocation and Step Functions for state management.
Many candidates choose E (MWAA) because it is a powerful orchestrator, but they overlook the 'MOST cost-effectively' constraint, as MWAA requires provisioning managed infrastructure which is significantly more expensive than serverless Lambda/Step Functions for this scale.
Community Discussion (28 comments)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
Expert Analysis
Why the Answer Is Correct
The correct combination is A and B. Option A uses an AWS Lambda function to callstart_query_execution. Although Lambda has a 15-minute execution timeout, the Athena query runs asynchronously in the background; Lambda simply triggers the request and can exit immediately or wait briefly, making it cost-effective for initiation. Option B uses AWS Step Functions to orchestrate the workflow. It employs a Wait state with a retry loop using the get_query_execution API to poll for completion, ensuring the next query starts only after the previous one finishes. This serverless approach minimizes costs by charging only for actual compute time used.Why the Other Options Are Wrong
Option C (Glue Python Shell) is less cost-effective than Lambda for simple triggering due to Glue's minimum billing granularity and startup overhead. Option D suggests using a sleep timer in a script, which is inefficient and prone to errors compared to the robust polling mechanisms provided by Step Functions. Option E (Amazon MWAA) is overly complex and expensive for this specific requirement; Managed Workflows for Apache Airflow is designed for large-scale, complex DAGs and incurs higher fixed costs than the pay-per-use model of Lambda and Step Functions.Community Comment Notes
Community consensus strongly supports AB. As user rralucard_ noted, "Lambda functions are cost-effective... no charge when the code is not running." User arvehisa clarified that "Lambda is a good option and it only trigger the athena not actually run it," highlighting the asynchronous nature of the service. Multiple users pointed out that Step Functions provide the necessary orchestration logic via Wait states to handle the long-running queries effectively.Official Reference
Exam Strategy
When asked for the 'most cost-effective' solution, always compare serverless options (Lambda, Step Functions) against managed services (Glue, EMR, MWAA). Remember that Lambda can trigger asynchronous jobs even if its own timeout is shorter than the job duration.
Frequently Asked Questions
Can Lambda trigger Athena queries longer than 15 minutes?
Yes. Lambda calls start_query_execution and exits; the query runs asynchronously in Athena regardless of Lambda's timeout.
Why is MWAA not the best choice here?
MWAA is more expensive and complex. For simple sequential querying, serverless Step Functions are more cost-effective.
Related Analysis
Practice All DEA-C01 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DEA-C01 Practice Test →