Question #493
A video streaming company has a pipe in Amazon EventBridge Pipes that uses an Amazon Simple Queue Service (Amazon SQS) queue as an event source. The pipe publishes all source events to a target EventBridge event bus. Before events are published, the pipe uses an AWS Lambda function to retrieve the stream status of each event from a database and adds the stream status to each source event.
The company wants the pipe to publish events to the event bus only if the video stream has a status of ready.
Which solution will meet these requirements?
Add a filter step to the pipe that will match on a stream status of ready.
Update the Lambda function to return only video streams that have a status of ready.
Include a filter for a status of ready in all EventBridge rules that subscribe to the event bus.
Add an input transformer to the pipe output that filters streams that have a status of ready.
Explanation
The correct answer is A. Adding a filter step to the pipe that matches on a stream status of 'ready' is the most effective way to ensure that only events with the required stream status are published to the EventBridge event bus. This approach allows event filtering to occur before the events are sent to the target, optimizing resource use and ensuring that only relevant events are processed further.
Now, let’s analyze each option to understand why option A is the best choice and why the others are not suitable:
- A. Add a filter step to the pipe that will match on a stream status of ready.
- This option correctly implements the requirement by applying a filter at the pipe level, ensuring that only events with a stream status of 'ready' are published. This is efficient as it prevents unwanted events from being processed downstream.
- B. Update the Lambda function to return only video streams that have a status of ready.
- This option modifies the concentration of events at the Lambda function’s output instead of filtering them in the pipe itself. It may not be practical if the Lambda function is expected to process varied events. Furthermore, this does not prevent unwanted events from being published to the event bus before Lambda execution.
- C. Include a filter for a status of ready in all EventBridge rules that subscribe to the event bus.
- While this option would filter events after they have already been sent to the EventBridge event bus, it does not adhere to the requirement of ensuring only those events are published in the first place. This could lead to the processing of unnecessary events, wasting resources.
- D. Add an input transformer to the pipe output that filters streams that have a status of ready.
- This option is not effective as input transformers are typically used to modify the output structure of events rather than filtering them at the time of publishing. Therefore, it does not meet the requirement of controlling which events get sent to the event bus based on their stream status.
In summary, option A correctly implements the filtering requirement before events reach the event bus, aligning with best practices for event-driven architecture and resource efficiency.
Answer
The correct answer is: A