How should the solutions architect address this issue in the MOST cost-effective manner?
Create a script that runs locally on an Amazon EC2 Reserved Instance that is triggered by a cron job.
Create an AWS Lambda function triggered by an Amazon EventBridge scheduled event.
Use an Amazon Elastic Container Service (Amazon ECS) Fargate task triggered by an Amazon EventBridge scheduled event.
Use an Amazon Elastic Container Service (Amazon ECS) task running on Amazon EC2 triggered by an Amazon EventBridge scheduled event.
Explanations:
Running a script on an EC2 Reserved Instance incurs costs regardless of usage, making it less cost-effective for a job that runs only once daily. Additionally, managing interruptions would still require manual handling, which may not be efficient.
AWS Lambda is not suitable for long-running jobs, as it has a maximum execution time limit of 15 minutes. Since the job can take up to 2 hours to complete, Lambda cannot be used effectively here.
Using an Amazon ECS Fargate task allows for a serverless architecture that can run for the required duration without managing the underlying infrastructure. This option is cost-effective as you pay only for the resources used during execution, and it handles the job restart automatically upon interruption.
While ECS tasks running on EC2 can run for long durations, it requires management of EC2 instances, leading to higher costs since EC2 instances are charged based on uptime rather than usage. This setup is not as cost-effective as Fargate for a job that runs infrequently.