Q27 — AWS SAA-C03 Ch.16

Question 27 of 100 | ← Chapter 16

Q1227. A company runs a Python script on an employee's laptop to transform and update data that is stored in an Amazon RDS database.The company wants to migrate the transformation workload to the AWS Cloud. The solution must run the Python script every 30 minutes. Each run of the script takes approximately 20 seconds to update the data in the RDS database.Which solution will meet these requirements MOST cost-effectively?

Correct Answer: C. Configure an AWS Lambda function to access the RDS database. Use Amazon EventBridge Scheduler to invoke the Lambda function.

Explanation

To meet the company's requirement of running a Python script every 30 minutes to update data in an Amazon RDS database while ensuring the solution is the most cost-effective, let's analyze the options:Option Analysis:A. Launch an Amazon EC2 On-Demand InstanceCost: On-Demand instances are billed per hour. Even though the script runs for only 20 seconds, you would still pay for the entire hour. Running this every 30 minutes would result in high costs because you'd be paying for two hours per hour (if scheduled perfectly, which is impractical). Suitability: Not cost-effective for short, frequent tasks.B. Launch an Amazon EC2 Spot InstanceCost: Spot instances are much cheaper but can be interrupted if the spot price exceeds your bid or capacity is no longer available.Suitability: Unreliable for a task that needs to run every 30 minutes without interruption. Interruptions would cause the script to fail, impacting data updates.C. Configure an AWS Lambda function + Amazon EventBridge Scheduler Cost: Lambda is billed based on the number of requests and the duration of execution (rounded to the nearest millisecond). Running a 20-second script would cost very little compared to an EC2 instance. Suitability: EventBridge Scheduler can trigger the Lambda function every 30 minutes precisely, meeting the timing requirement. This is a serverless solution, so there's no need to manage servers, and it scales automatically.D. Configure an AWS Lambda function with provisioned concurrency + Amazon API Gateway HTTP API Cost: Provisioned concurrency is used to reduce cold starts, but for a script that runs in 20 seconds, cold starts are likely negligible. Additionally, API Gateway is used for HTTP-based triggers, which is not needed here since the requirement is for automatic, timed execution. Suitability: This setup is more complex and costly than necessary for a simple, timed task. It introduces unnecessary components (API Gateway) and costs (provisioned concurrency) for this use case.Conclusion:Option C (AWS Lambda + Amazon EventBridge Scheduler) is the most cost-effective solution. It leverages Lambda's pay-per-use pricing model and EventBridge Scheduler's precise timing capabilities to ensure the script runs every 30 minutes reliably and at the lowest possible cost. This serverless approach eliminates the need for server management and scales effortlessly.