Q8 — AWS DEA-C01 Ch.1
Question 8 of 100 | ← Chapter 1
A data engineer needs to create an AWS Lambda function that converts the format of data from .csv to Apache Parquet. The Lambda function must run only if a user uploads a .csv file to an Amazon S3 bucket. Which solution will meet these requirements with the LEAST operational overhead?
- A. Create an S3 event notification that has an event type of s3:ObjectCreated:*. Use a filter rule to generate notifications only when the suffix includes .csv. Set the Amazon Resource Name (ARN) of the Lambda function as the destination for the event notification. ✓
- B. Create an S3 event notification that has an event type of s3:ObjectTagging:* for objects that have a tag set to .csv. Set the Amazon Resource Name (ARN) of the Lambda function as the destination for the event notification.
- C. Create an S3 event notification that has an event type of s3:*. Use a filter rule to generate notifications only when the suffix includes .csv. Set the Amazon Resource Name (ARN) of the Lambda function as the destination for the event notification.
- D. Create an S3 event notification that has an event type of s3:ObjectCreated:*. Use a filter rule to generate notifications only when the suffix includes .csv. Set an Amazon Simple Notification Service (Amazon SNS) topic as the destination for the event notification. Subscribe the Lambda function to the SNS topic.
Correct Answer: A. Create an S3 event notification that has an event type of s3:ObjectCreated:*. Use a filter rule to generate notifications only when the suffix includes .csv. Set the Amazon Resource Name (ARN) of the Lambda function as the destination for the event notification.
Explanation
在AWS中,要创建一个Lambda函数以响应特定事件(如S3中的文件上传),可以配置S3事件通知。为了最小化操作开销,应选择最直接和高效的事件类型及过滤机制。选项A指定了事件类型为`s3:ObjectCreated:*`,这意味着当有对象被创建时(即文件上传),会触发事件。通过添加一个过滤规则,只有当文件后缀为.csv时,才生成通知并触发Lambda函数。这样避免了不必要的Lambda函数执行,从而减少了操作开销。其他选项要么使用了不必要的事件类型(如B选项的`s3:ObjectTagging:*`),要么包含了不必要的事件(如C选项的`s3:*`),或者引入了额外的服务(如D选项的SNS),都会增加操作开销。因此,A选项是最符合要求的解决方案。