Q55 — AWS SAA-C03 Ch.16

Question 55 of 100 | ← Chapter 16

Q1255. A company creates daily and monthly business metrics from data that partners provide.Each day,the partners deliver JSON data files to an Amazon S3 bucket that the company owns.The S3 object keys use Apache Hive style date partitions.The company uses an Amazon EventBridge rule to invoke an AWS Lambda function that reads all objects in the S3 bucket to aggregate the daily and monthly metricsThe company performs occasional analysis that requires access to historical data. As more data has accumulated, the Lambda function is timing out frequently.A solutions architect must prevent the Lambda function timeoutsWhich solution will meet these requirements with the LEAST operational overhead?

Correct Answer: C. Modify the Lambda function to query the S3 objects by using Amazon Athena with date filters.

Explanation

The correct answer is C. Modify the Lambda function to query the S3 objects by using Amazon Athena with date filters.Explanation:The problem arises because the Lambda function is reading all objects in the S3 bucket (including historical data) every time it runs, leading to timeouts as the dataset grows. The solution should reduce the amount of data processed while still allowing daily and monthly metric aggregation.Why Option C is the Best Choice:Amazon Athena allows querying S3 data directly using SQL, with partition pruning (Hive-style partitions like year=2023/month=10/day=15).The Lambda function can query only the necessary partitions (e.g., WHERE date = CURRENT_DATE for daily metrics or WHERE date BETWEEN start_of_month AND end_of_month for monthly metrics). No need to read all objects--Athena scans only the relevant partitions, drastically reducing processing time.Low operational overhead--no need to modify the data structure or set up complex pipelines.Why the Other Options Are Less Optimal:A. Update EventBridge to invoke Step Functions for retries Does not solve the root cause (Lambda still processes all data). Adds complexity (Step Functions) without reducing processing time.B. Modify Lambda to delete older S3 objectsDeletes historical data, which is needed for occasional analysis (violates the requirement). Not a sustainable solution--data retention policies should not be handled this way.D. Create an AWS Glue job to invoke LambdaGlue is for ETL, not for simple querying.Still processes all data unless combined with partitioning (which Athena already handles efficiently).Higher operational overhead (Glue job setup, monitoring).Conclusion:Option C is the most efficient and least operationally intensive solution because:It leverages partition pruning in Athena to query only necessary data.Avoids Lambda timeouts by reducing processing time.Preserves historical data for analysis.Requires minimal changes (just SQL queries with date filters).Final Answer:C