
Answer-first summary for fast verification
Answer: Use an Amazon Elastic Container Service (Amazon ECS) Fargate task triggered by an Amazon EventBridge scheduled event.
## Explanation **Correct Answer: C - Use an Amazon Elastic Container Service (Amazon ECS) Fargate task triggered by an Amazon EventBridge scheduled event.** ### Why Option C is Correct: 1. **Cost-Effectiveness**: ECS Fargate is serverless, meaning you only pay for the compute resources consumed while the task is running (2 hours daily). There's no need to pay for idle EC2 instances 24/7. 2. **Job Duration**: Lambda functions have a maximum execution timeout of 15 minutes, so a 2-hour job cannot run on Lambda (eliminating Option B). 3. **Restart Requirement**: The job needs to restart from the beginning if interrupted. ECS Fargate tasks can be configured with appropriate retry logic and can handle longer-running jobs. 4. **Scheduling**: Amazon EventBridge provides reliable scheduling for once-daily execution. ### Analysis of Other Options: **Option A - EC2 Reserved Instance with cron job**: - **Not cost-effective**: Requires paying for the EC2 instance 24/7 even though it's only used 2 hours daily. - Reserved Instances require upfront payment or commitment, which is inefficient for intermittent workloads. - Local cron jobs lack AWS-managed monitoring and retry capabilities. **Option B - AWS Lambda function**: - **Not feasible**: Lambda has a maximum execution timeout of 15 minutes, so a 2-hour job cannot complete. - Lambda is designed for short-running, stateless functions, not long-running data processing jobs. **Option D - ECS task on EC2**: - **Less cost-effective than Fargate**: Requires provisioning and paying for EC2 instances continuously. - Requires managing the underlying infrastructure (scaling, patching, maintenance). - While it would work technically, it's not the MOST cost-effective option compared to serverless Fargate. ### Key Considerations: - **Serverless vs. Provisioned**: For intermittent workloads (2 hours daily), serverless options (Fargate) are more cost-effective than always-on infrastructure. - **Job Characteristics**: The job's 2-hour duration and restart requirement make containerized solutions (ECS) appropriate. - **Managed Services**: Fargate abstracts infrastructure management, reducing operational overhead. ### Best Practices for This Scenario: 1. Use ECS Fargate with appropriate CPU and memory allocation 2. Configure EventBridge with retry policies 3. Implement checkpointing in the application code if possible (though the question states it must restart from beginning) 4. Monitor task execution with CloudWatch 5. Consider using Spot Fargate for additional cost savings if the job can tolerate interruptions
Ultimate access to all questions.
No comments yet.
Author: LeetQuiz Editorial Team
A solutions architect is creating a data processing job that runs once daily and can take up to 2 hours to complete. If the job is interrupted, it has to restart from the beginning. How should the solutions architect address this issue in the MOST cost-effective manner?
A
Create a script that runs locally on an Amazon EC2 Reserved Instance that is triggered by a cron job.
B
Create an AWS Lambda function triggered by an Amazon EventBridge scheduled event.
C
Use an Amazon Elastic Container Service (Amazon ECS) Fargate task triggered by an Amazon EventBridge scheduled event.
D
Use an Amazon Elastic Container Service (Amazon ECS) task running on Amazon EC2 triggered by an Amazon EventBridge scheduled event.