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 (Amazon CloudWatch Events) scheduled event.
Use an Amazon Elastic Container Service (Amazon ECS) Fargate task triggered by an Amazon EventBridge (Amazon CloudWatch Events) scheduled event.
Use an Amazon Elastic Container Service (Amazon ECS) task running on Amazon EC2 triggered by an Amazon EventBridge (Amazon CloudWatch Events) scheduled event.
Explanations:
Running a script on an EC2 Reserved Instance incurs costs regardless of usage and may not be cost-effective for a job that only runs daily for 2 hours. Additionally, if interrupted, the job would need to restart without built-in resiliency.
AWS Lambda has a maximum execution time of 15 minutes, which is insufficient for a job that can take up to 2 hours. This option cannot handle the job’s requirements.
Using Amazon ECS Fargate allows for serverless container deployment, which can efficiently manage resources. It can handle jobs longer than 15 minutes and is billed based on actual usage, making it cost-effective for a daily job. Additionally, it can restart if interrupted.
While an ECS task on EC2 can run long jobs, it involves the cost of running EC2 instances, which can be more expensive than using Fargate for a job that only runs for 2 hours daily. This option does not leverage the cost-efficiency of serverless architecture.