Q52 — AWS SOA-C02 Ch.1
Question 52 of 100 | ← Chapter 1
A SysOps administrator needs to automate the invocation of an AWS Lambda function. The Lambda function must run at the end of each day to generate a report on data that is stored in an Amazon S3 bucket. What is the MOST operationally efficient solution that meets these requirements?
- A. Create an Amazon EventBridge (Amazon CloudWatch Events) rule that has an event pattern for Amazon S3 and the Lambda function as a target.
- B. Create an Amazon EventBridge (Amazon CloudWatch Events) rule that has a schedule and the Lambda function as a target. ✓
- C. Create an S3 event notification to invoke the Lambda function whenever objects change in the S3 bucket.
- D. Deploy an Amazon EC2 instance with a cron job to invoke the Lambda function.
Correct Answer: B. Create an Amazon EventBridge (Amazon CloudWatch Events) rule that has a schedule and the Lambda function as a target.
Explanation
对于这个题目,关键在于找到一个在每天结束时自动调用AWS Lambda函数的最高效的操作解决方案。我们逐一分析选项: A. 使用Amazon EventBridge的S3事件模式来调用Lambda函数。这种方法虽然可以在S3中有事件发生时触发Lambda函数,但它不保证每天固定时间执行,因为S3事件是数据驱动的,不保证时效性。 B. 使用Amazon EventBridge(之前称为CloudWatch Events)创建一个带有时间计划的规则,并设置Lambda函数为目标。这种方法可以确保Lambda函数按照预定的时间表执行,即每天结束时运行,从而生成报告。 C. 使用S3的事件通知来在对象更改时调用Lambda函数。这同样是一种数据驱动的触发方式,虽然可以响应S3中的数据变化,但无法确保每天固定时间执行。 D. 部署一个带有cron job的Amazon EC2实例来调用Lambda函数。这种方法虽然可以实现定时任务,但相对复杂且成本较高,且不如直接使用EventBridge这样的服务来得高效。 综上所述,最符合题意的答案是B,因为它是操作上最有效的方式,能够确保Lambda函数每天都在固定时间被调用,用于生成存储在Amazon S3存储桶中的数据的报告。 因此,正确答案是B。