Question #917
A developer is designing a user registration service. When a user successfully registers, the application must trigger three separate backend processes: sending a welcome email, creating a user profile in a database, and logging the registration event for analytics. Each process is implemented as an AWS Lambda function with distinct business logic. The processes are independent and must execute regardless of the success or failure of the others. Which solution ensures all Lambda functions are invoked without dependency on each other's outcomes?
Publish the registration event to an Amazon Simple Queue Service (SQS) queue. Configure the three Lambda functions to poll the queue.
Publish the registration event to an Amazon Simple Notification Service (SNS) topic. Subscribe the three Lambda functions to be triggered by the SNS topic.
Publish the registration event to an Application Load Balancer (ALB). Add the three Lambda functions as ALB targets.
Publish the registration event to an AWS Step Functions state machine. Integrate the logic from the three Lambda functions into the Step Functions workflow.
Explanation
Answer B is correct because Amazon SNS (Simple Notification Service) enables a pub/sub pattern where a single event (user registration) is published to an SNS topic, and all subscribed Lambda functions are triggered simultaneously. Each Lambda function processes the event independently, ensuring that failures in one do not affect the others. This decoupled design aligns with the requirement for independent execution.
Incorrect options:
- A: SQS queues are designed for point-to-point messaging, where only one consumer processes a message. This would not trigger all three Lambdas.
- C: ALB routes requests synchronously and is not designed for asynchronous event-driven fan-out to multiple Lambdas.
- D: Step Functions coordinates workflows with dependencies, which contradicts the requirement for independent execution.
Key Points:
- Use SNS for fan-out, asynchronous event-driven architectures.
- Lambda functions subscribed to SNS topics run independently, ensuring fault isolation.
- Avoid solutions that introduce coupling or sequential processing unless explicitly required.
Answer
The correct answer is: B