You want an SNS topic to send SMS notifications and also invoke a Lambda function whenever a message is published. How should you set up the subscriptions?
hard📝 Application Q8 of 15
AWS - SNS and SQS
You want an SNS topic to send SMS notifications and also invoke a Lambda function whenever a message is published. How should you set up the subscriptions?
ACreate two subscriptions on the SNS topic: one with protocol 'sms' and the other with protocol 'lambda', each with their respective endpoints
BCreate a single subscription with protocol 'lambda' that sends SMS messages via the Lambda function
CCreate two subscriptions with protocol 'email' and forward emails to SMS and Lambda
DCreate one subscription with protocol 'sms' and configure the Lambda function to poll the SMS messages
Step-by-Step Solution
Solution:
Step 1: Understand SNS subscription model
SNS topics can have multiple subscriptions with different protocols simultaneously.
Step 2: Configure separate subscriptions
To send SMS and invoke Lambda, create two subscriptions: one with 'sms' protocol and phone number endpoint, another with 'lambda' protocol and Lambda ARN.
Step 3: Evaluate other options
Create a single subscription with protocol 'lambda' that sends SMS messages via the Lambda function is incorrect because SNS does not send SMS via Lambda automatically; Create two subscriptions with protocol 'email' and forward emails to SMS and Lambda is invalid as email cannot forward to SMS or Lambda directly; Create one subscription with protocol 'sms' and configure the Lambda function to poll the SMS messages is incorrect because Lambda does not poll SMS messages.
Final Answer:
Option A -> Option A
Quick Check:
Multiple subscriptions with different protocols [OK]
Quick Trick:Use separate SNS subscriptions for SMS and Lambda [OK]
Common Mistakes:
Trying to send SMS via Lambda subscription alone
Using email protocol to forward to SMS or Lambda
Assuming Lambda polls SMS messages
Master "SNS and SQS" in AWS
9 interactive learning modes - each teaches the same concept differently