Bird
Raised Fist0
AWScloud~10 mins

SNS notification types (email, SMS, Lambda) in AWS - Step-by-Step Execution

Choose your learning style10 modes available
Process Flow - SNS notification types (email, SMS, Lambda)
SNS Topic Created
↓
Subscribe Email
→Subscribe SMS
↓
Email Endpoint
↓
Publish Message to Topic
↓
SNS Sends Notification to All Subscribers
↓
Email Received, SMS Received, Lambda Invoked
SNS topic has subscribers of different types (email, SMS, Lambda). When a message is published, SNS sends notifications to all subscribers according to their type.
Execution Sample
AWS
Create SNS topic
Subscribe email endpoint
Subscribe SMS number
Subscribe Lambda function
Publish message to topic
This sequence creates an SNS topic, adds email, SMS, and Lambda subscribers, then publishes a message triggering notifications.
Process Table
StepActionTargetResultNotification Sent
1Create SNS TopicMyTopicTopic CreatedNo
2SubscribeEmail user@example.comSubscription Pending ConfirmationNo
3SubscribeSMS +1234567890Subscription ConfirmedNo
4SubscribeLambda Function ARNSubscription ConfirmedNo
5Email User Confirms Subscriptionuser@example.comSubscription ConfirmedNo
6Publish MessageMyTopicMessage PublishedYes: Email, SMS, Lambda
7SNS Sends Emailuser@example.comEmail DeliveredYes
8SNS Sends SMS+1234567890SMS DeliveredYes
9SNS Invokes LambdaLambda FunctionLambda ExecutedYes
10End-All Notifications SentNo
💡 All subscribers confirmed and message published; notifications sent to all.
Status Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5After Step 6Final
SNS TopicNoneCreatedCreatedCreatedCreatedCreatedCreated
Email SubscriptionNonePendingPendingPendingConfirmedConfirmedConfirmed
SMS SubscriptionNoneNoneConfirmedConfirmedConfirmedConfirmedConfirmed
Lambda SubscriptionNoneNoneNoneConfirmedConfirmedConfirmedConfirmed
Message PublishedNoNoNoNoNoYesYes
Notifications SentNoNoNoNoNoYesYes
Key Moments - 3 Insights
Why does the email subscription show 'Pending' before confirmation?
Email subscriptions require the user to confirm by clicking a link. Until confirmed (see Step 5), SNS does not send notifications to that email.
Why are SMS and Lambda subscriptions confirmed immediately?
SMS and Lambda subscriptions do not require user confirmation, so SNS marks them as confirmed right after subscription (Steps 3 and 4).
When does SNS send notifications to subscribers?
SNS sends notifications only after a message is published to the topic and the subscriber is confirmed (Step 6 triggers sending in Steps 7-9).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the status of the email subscription at Step 3?
AConfirmed
BNone
CPending Confirmation
DUnsubscribed
💡 Hint
Check the 'Result' column at Step 3 in the execution_table.
At which step does SNS send notifications to all subscribers?
AStep 6
BStep 5
CStep 7
DStep 10
💡 Hint
Look for 'Message Published' and 'Notifications Sent' in the execution_table.
If the email user never confirms subscription, what changes in the execution table?
AEmail subscription becomes 'Confirmed' automatically
BEmail subscription stays 'Pending', no email sent
CSNS sends email anyway
DLambda subscription fails
💡 Hint
Refer to the 'Email Subscription' variable in variable_tracker and Step 5 in execution_table.
Concept Snapshot
SNS Topic holds subscribers of types: Email, SMS, Lambda.
Email requires user confirmation before receiving messages.
SMS and Lambda subscriptions confirm immediately.
Publishing a message sends notifications to all confirmed subscribers.
SNS handles delivery according to subscriber type.
Full Transcript
This visual execution traces how AWS SNS handles different notification types: email, SMS, and Lambda. First, an SNS topic is created. Then, subscribers are added: an email address, a phone number for SMS, and a Lambda function. Email subscriptions require the user to confirm by clicking a link, so initially, the email subscription is pending. SMS and Lambda subscriptions confirm immediately. When a message is published to the topic, SNS sends notifications only to confirmed subscribers. The email user receives an email after confirmation, SMS receives a text message, and the Lambda function is invoked. This process ensures reliable delivery tailored to each subscriber type.

Practice

(1/5)
1. Which of the following is NOT a valid protocol for an AWS SNS subscription?
easy
A. email
B. sms
C. lambda
D. ftp

Solution

  1. Step 1: Review SNS supported protocols

    AWS SNS supports protocols like email, sms, and lambda for subscriptions.
  2. Step 2: Identify unsupported protocol

    FTP is not supported as a protocol for SNS subscriptions.
  3. Final Answer:

    ftp -> Option D
  4. Quick Check:

    Supported protocols exclude ftp [OK]
Hint: Remember SNS supports email, sms, lambda but not ftp [OK]
Common Mistakes:
  • Confusing FTP as supported protocol
  • Thinking HTTP is the only protocol
  • Mixing SNS with S3 protocols
2. Which is the correct way to specify an SMS subscription protocol in AWS SNS?
easy
A. Protocol: 'sms', Endpoint: 'user@example.com'
B. Protocol: 'email', Endpoint: '+1234567890'
C. Protocol: 'sms', Endpoint: '+1234567890'
D. Protocol: 'lambda', Endpoint: '+1234567890'

Solution

  1. Step 1: Understand protocol and endpoint types

    For SMS, protocol must be 'sms' and endpoint is a phone number with country code.
  2. Step 2: Match correct protocol and endpoint

    Protocol: 'sms', Endpoint: '+1234567890' correctly uses 'sms' protocol and a phone number endpoint.
  3. Final Answer:

    Protocol: 'sms', Endpoint: '+1234567890' -> Option C
  4. Quick Check:

    SMS needs phone number endpoint [OK]
Hint: SMS protocol requires phone number endpoint format [OK]
Common Mistakes:
  • Using email as protocol for SMS
  • Using email address as SMS endpoint
  • Using lambda protocol with phone number
3. Given this AWS SNS subscription code snippet:
sns.subscribe({
  Protocol: 'lambda',
  Endpoint: 'arn:aws:lambda:us-east-1:123456789012:function:ProcessMessage'
});

What happens when a message is published to this SNS topic?
medium
A. The Lambda function 'ProcessMessage' is invoked with the message payload.
B. The message is sent as an SMS to the Lambda function ARN.
C. The message is sent as an email to the Lambda function.
D. The subscription will fail because Lambda cannot be an endpoint.

Solution

  1. Step 1: Identify protocol and endpoint meaning

    Protocol 'lambda' means SNS invokes the specified Lambda function ARN when a message is published.
  2. Step 2: Understand message delivery behavior

    The Lambda function 'ProcessMessage' is called with the message payload as input.
  3. Final Answer:

    The Lambda function 'ProcessMessage' is invoked with the message payload. -> Option A
  4. Quick Check:

    Lambda protocol triggers function invocation [OK]
Hint: Lambda protocol triggers function call, not email or SMS [OK]
Common Mistakes:
  • Thinking Lambda receives email or SMS
  • Assuming subscription fails
  • Confusing endpoint ARN with phone/email
4. You created an SNS subscription with protocol 'email' but the subscriber never receives messages. What is the most likely cause?
medium
A. The email address was not confirmed by the subscriber.
B. The SNS topic does not support email protocol.
C. The subscription endpoint was set to a phone number.
D. Lambda function is not attached to the subscription.

Solution

  1. Step 1: Understand email subscription confirmation

    Email subscriptions require the recipient to confirm by clicking a link in a confirmation email.
  2. Step 2: Identify common cause of no delivery

    If the email is not confirmed, SNS will not send notifications to that address.
  3. Final Answer:

    The email address was not confirmed by the subscriber. -> Option A
  4. Quick Check:

    Email subscriptions need confirmation [OK]
Hint: Email subscriptions require confirmation before delivery [OK]
Common Mistakes:
  • Assuming SNS does not support email
  • Confusing phone number as email endpoint
  • Expecting Lambda involvement in email subscription
5. You want to send an SMS notification and also trigger a Lambda function whenever a message is published to an SNS topic. How should you configure the subscriptions?
hard
A. Create one subscription with protocol 'email' and endpoint as phone number, and another with protocol 'lambda' and endpoint as Lambda ARN.
B. Create one subscription with protocol 'sms' and endpoint as phone number, and another with protocol 'lambda' and endpoint as Lambda ARN.
C. Create one subscription with protocol 'lambda' and endpoint as phone number, and another with protocol 'sms' and endpoint as Lambda ARN.
D. Create one subscription with protocol 'sms' and endpoint as Lambda ARN, and another with protocol 'lambda' and endpoint as phone number.

Solution

  1. Step 1: Understand protocol and endpoint matching

    SMS protocol requires a phone number endpoint; Lambda protocol requires Lambda function ARN.
  2. Step 2: Configure two subscriptions correctly

    Create one subscription with protocol 'sms' and phone number endpoint, and another with protocol 'lambda' and Lambda ARN endpoint.
  3. Final Answer:

    Create one subscription with protocol 'sms' and endpoint as phone number, and another with protocol 'lambda' and endpoint as Lambda ARN. -> Option B
  4. Quick Check:

    Match protocol to correct endpoint type [OK]
Hint: Match SMS to phone number, Lambda to function ARN [OK]
Common Mistakes:
  • Mixing endpoints and protocols
  • Using email protocol for SMS
  • Assigning Lambda ARN as SMS endpoint
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard