SOA-C02 Question 44
Single answerA company is using Amazon EventBridge to route events from various AWS services. They want to configure a rule that triggers an AWS Lambda function whenever an Amazon S3 bucket receives a PUT request. The rule must also ensure that the Lambda function only processes events from a specific S3 bucket named 'my-data-bucket'. How should the SysOps Administrator configure the EventBridge rule?
- A
Set the EventBridge rule's event source to 'aws.s3', add a condition to filter events where the bucket name matches 'my-data-bucket', and configure the Lambda function as the target.
- B
Set the EventBridge rule's event source to 'aws.s3', specify the 's3:ObjectCreated:Put' event type, and configure the Lambda function as the target.
- C
Set the EventBridge rule's event pattern to include the 'source' as 'aws.s3', the 'eventName' as 's3:ObjectCreated:Put', and the 'bucketName' as 'my-data-bucket', then configure the Lambda function as the target.
- D
Set the EventBridge rule's source as 'my-data-bucket', specify the 'eventType' as 'PUT', and configure the Lambda function as the target.
Show answer and explanation
Correct answer: C
Explanation
To configure an Amazon EventBridge rule to filter events from a specific S3 bucket and trigger a Lambda function, the rule must have a well-defined event pattern. The event pattern should include the 'source' as 'aws.s3', the 'eventName' as 's3:ObjectCreated:Put', and the specific bucket name in the 'resources' or 'bucketName' field. This ensures that only events matching these criteria will trigger the Lambda function. Option 3 correctly describes this configuration.
- A. Incorrect.
Incorrect: While this option mentions a condition to filter by bucket name, it does not include details about specifying the correct event pattern for 's3:ObjectCreated:Put'. EventBridge does not use conditions in this way; instead, patterns are used to filter events.
- B. Incorrect.
Incorrect: This option only specifies the event type but does not filter events by the bucket name 'my-data-bucket'. The solution must ensure the rule is scoped to events from the specific bucket.
- C. Correct.
Correct: This option correctly specifies the EventBridge rule pattern to filter by the event source ('aws.s3'), event name ('s3:ObjectCreated:Put'), and the specific bucket name ('my-data-bucket'). This ensures the Lambda function is only triggered for PUT events on the specified bucket.
- D. Incorrect.
Incorrect: This option incorrectly assumes that the EventBridge rule's source can be set directly to the bucket name and uses an invalid pattern. EventBridge requires patterns to describe event attributes such as the source and event name.