Which is the MOST cost-effective solution?
Launch a single t2.nano Amazon EC2 instance and create a Linux cron job to invoke the Lambda function at the same time every night.
Set up an Amazon CloudWatch metrics alarm to invoke the Lambda function at the same time every night.
Schedule an Amazon EventBridge (Amazon CloudWatch Events) rule to invoke the Lambda function at the same time every night.
Implement a Chef recipe in AWS OpsWorks stack to invoke the Lambda function at the same time every night.
Explanations:
Launching an EC2 instance incurs ongoing costs, even if the instance is idle during the day. Additionally, setting up a cron job to invoke the Lambda function adds complexity without any cost benefits over simpler scheduling mechanisms like EventBridge.
CloudWatch metrics alarms are typically used for monitoring and reacting to specific thresholds or conditions. It is not designed for simple, scheduled invocations of Lambda functions, making it an inappropriate choice for this task.
EventBridge (formerly CloudWatch Events) is designed for scheduled events and is a cost-effective solution for invoking Lambda functions at regular intervals, such as nightly. It is serverless, meaning you only pay for the invocations and there are no additional infrastructure costs.
AWS OpsWorks is a configuration management service for automating server tasks and is more complex than necessary for a simple scheduled Lambda invocation. It incurs additional overhead and costs compared to a straightforward EventBridge rule.