📖 Scenario: You are setting up a notification system for a small online store. When an order is placed, the system should notify the store owner by email, send a text message to the manager, and trigger a Lambda function to update the inventory.
🎯 Goal: Create an AWS SNS topic with three subscriptions: one for email notifications, one for SMS notifications, and one that triggers a Lambda function.
📋 What You'll Learn
Create an SNS topic named OrderNotifications.
Subscribe an email endpoint owner@example.com to the topic.
Subscribe an SMS endpoint +1234567890 to the topic.
Subscribe a Lambda function named UpdateInventoryFunction to the topic.
💡 Why This Matters
🌍 Real World
SNS topics are used to send notifications to multiple endpoints like email, SMS, and Lambda functions in real-world applications such as order processing, alerts, and system monitoring.
💼 Career
Understanding how to configure SNS with different subscription types and Lambda integration is essential for cloud engineers and developers working with AWS event-driven architectures.
Progress0 / 4 steps
1
Create the SNS topic
Create an SNS topic named OrderNotifications using AWS CloudFormation syntax.
AWS
Hint
Use the AWS::SNS::Topic resource type and set TopicName to OrderNotifications.
2
Add email and SMS subscriptions
Add two subscriptions to the OrderNotifications topic: one email subscription with endpoint owner@example.com and one SMS subscription with endpoint +1234567890.
AWS
Hint
Use the Subscription property with a list of subscriptions. Each subscription needs a Protocol and an Endpoint.
3
Add Lambda function resource
Create a Lambda function resource named UpdateInventoryFunction with runtime python3.12 and handler index.handler. Use a placeholder for the code with inline code "exports.handler = async () => {};".
AWS
Hint
Define the Lambda function with AWS::Lambda::Function. Use ZipFile for inline code. You must specify a valid Role ARN (use a placeholder ARN).
4
Subscribe Lambda function to SNS topic
Add a subscription to the OrderNotifications topic that triggers the Lambda function UpdateInventoryFunction. Use protocol lambda and the function's ARN reference.
AWS
Hint
Add a subscription with Protocol: lambda and use !GetAtt UpdateInventoryFunction.Arn to reference the Lambda ARN.
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
Step 1: Review SNS supported protocols
AWS SNS supports protocols like email, sms, and lambda for subscriptions.
Step 2: Identify unsupported protocol
FTP is not supported as a protocol for SNS subscriptions.
Final Answer:
ftp -> Option D
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
Step 1: Understand protocol and endpoint types
For SMS, protocol must be 'sms' and endpoint is a phone number with country code.
Step 2: Match correct protocol and endpoint
Protocol: 'sms', Endpoint: '+1234567890' correctly uses 'sms' protocol and a phone number endpoint.
Final Answer:
Protocol: 'sms', Endpoint: '+1234567890' -> Option C
Quick Check:
SMS needs phone number endpoint [OK]
Hint: SMS protocol requires phone number endpoint format [OK]
Email subscriptions require the recipient to confirm by clicking a link in a confirmation email.
Step 2: Identify common cause of no delivery
If the email is not confirmed, SNS will not send notifications to that address.
Final Answer:
The email address was not confirmed by the subscriber. -> Option A
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
Step 1: Understand protocol and endpoint matching
SMS protocol requires a phone number endpoint; Lambda protocol requires Lambda function ARN.
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.
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
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 unknownstrongwhile earning +1 Grip toward your certificate.