
AWS CloudOps Learning Journey | Skill 1.1.5 – Configure and Manage Amazon Simple Notification Service (Amazon SNS)
Understand how Amazon SNS enables reliable message distribution and notifications across multiple subscribers. Learn about Standard and FIFO topics, subscription protocols, message filtering, and how to integrate SNS with CloudWatch Alarms through practical examples and troubleshooting.
Series: My CloudOps Learning Journey (7 articles)
- …
- 6AWS CloudOps Learning Journey | Skill 1.1.5 – Configure and Manage Amazon Simple Notification Service (Amazon SNS) This article
1. Why Do We Need Amazon SNS?
Imagine you are monitoring an EC2 instance using Amazon CloudWatch.
Your CPU utilization suddenly increases beyond the configured threshold. CloudWatch detects the problem and changes the alarm state to
ALARM .But how will the administrator know about it?
This is where Amazon Simple Notification Service (Amazon SNS) comes in.
Amazon SNS is a fully managed messaging service that distributes messages from publishers to multiple subscribers. It helps applications and administrators receive notifications without requiring the publisher to communicate separately with every recipient.
Real-world analogy:
Think of SNS as a college announcement system:
- College administration publishes an announcement.
- The announcement system distributes it to subscribed students.
- Students receive it through their registered communication channels.
Similarly, SNS distributes messages to subscribed endpoints.
2. Core Concepts
Understand these four components before using SNS.
Component | Meaning |
|---|---|
Topic | Communication channel where messages are published |
Publisher | Application or service that sends a message |
Subscriber | Person or application that receives messages |
Subscription | Connection between a topic and its endpoint |
How SNS works
Publisher → SNS Topic → Subscribers Example:
An EC2 monitoring application publishes an alert to an SNS topic. That topic can deliver the notification to an email subscriber, an SQS queue, and a Lambda function.
One publisher can therefore notify multiple subscribers through a single topic.
3. Important SNS Features
A. Topic Types
Amazon SNS supports two main topic types:
Standard Topic
- Supports high-throughput message delivery.
- Does not guarantee message ordering.
- Messages can occasionally be delivered more than once.
- Supports a broad range of endpoint types.
Use it when ordering is not critical.
Example: Sending CloudWatch CPU alerts through email.
FIFO Topic (First-In, First-Out)
- Preserves message ordering within a message group.
- Supports message deduplication.
- Designed for applications where message order matters.
- Supports Amazon SQS standard and FIFO queue subscriptions, but not email, SMS, or HTTP/S endpoints.
Example: Sending ordered transaction events to an SQS FIFO queue.
B. Subscription Protocols
A topic can have different types of subscribers.
Protocol | Purpose |
|---|---|
Email | Send notifications to an email address |
SMS | Send text messages |
Amazon SQS | Deliver messages to a queue |
AWS Lambda | Trigger a function |
HTTP/HTTPS | Send messages to a web endpoint |
Application | Send mobile push notifications |
Important: Email, HTTP/S endpoints, and certain cross-account subscriptions require confirmation before they can receive messages.
C. Message Filtering
By default, every subscriber receives every message published to a topic.
A Filter Policy allows a subscriber to receive only messages matching specified conditions.
Example:
- Operations team receives messages with
severity = High.
- Development team receives messages with
severity = Low.
Filtering can use message attributes or, when configured, the message body.
D. Delivery Retries and Dead-Letter Queues
What happens if a subscriber endpoint is temporarily unavailable?
- SNS attempts delivery again according to the delivery policy.
- If delivery continues to fail, SNS stops retrying after the applicable policy is exhausted.
- A configured Dead-Letter Queue (DLQ) can retain undelivered messages for investigation or reprocessing.
Remember: An SNS DLQ is an Amazon SQS queue attached to an SNS subscription, not directly to the topic.
4. Hands-On Demo 1 – Create an SNS Topic and Send an Email
Objective: Create an SNS topic, subscribe an email address, confirm the subscription, and publish a test message.
Step 1: Create a topic
- Open the Amazon SNS Console.
- Navigate to Topics.
- Select Create topic.
- Choose Standard.
- Enter the topic name:
CloudOps-Alerts.
- Create the topic.
- Copy the Topic ARN.
Step 2: Create an email subscription
- Open Subscriptions.
- Select Create subscription.
- Choose the topic ARN created above.
- Select Protocol:
Email.
- Enter an email address you can access.
- Select Create subscription.
Step 3: Confirm the subscription
- Open your email inbox.
- Find the AWS subscription confirmation email.
- Select Confirm subscription.
- Return to SNS and verify that the subscription status is
Confirmed.
Without confirmation, the email endpoint will not receive topic notifications.
Step 4: Publish a test message
- Navigate to Topics.
- Select
CloudOps-Alerts.
- Choose Publish message.
- Subject:
CloudOps Test Alert
- Message:
SNS notification test successful.
- Select Publish message.
Verification: Check your email inbox and confirm that the message arrived.
5. Hands-On Demo 2 – Connect CloudWatch Alarm to SNS
Now connect the previous concepts with the CloudWatch monitoring skills.
Objective: Receive an email when EC2 CPU utilization exceeds a configured threshold.
Step 1: Prepare an SNS topic
Use the
CloudOps-Alerts topic and its confirmed email subscription from Demo 1.Step 2: Create a CloudWatch alarm
- Open the CloudWatch Console.
- Navigate to Alarms → Create alarm.
- Select Select metric.
- Choose EC2 → Per-Instance Metrics.
- Select the required EC2 instance and
CPUUtilization.
- Choose the statistic
Average.
- Set the period to
1 minute.
- Configure the threshold:
- Threshold type: Static
- Whenever CPUUtilization is: Greater than
- Threshold:
70
Step 3: Configure SNS notification
- Under Notification, select the
ALARMstate.
- Choose the existing SNS topic:
CloudOps-Alerts.
- Continue and create the alarm.
Step 4: Test the notification
Generate CPU activity on your test EC2 instance, if appropriate.
Wait for CloudWatch to evaluate the metric and check whether the alarm changes to
ALARM .Verification:
- CloudWatch alarm state changes to
ALARM.
- SNS receives the notification request.
- The confirmed email subscriber receives the alert.
Do not expect an instant notification: CloudWatch must evaluate the metric and the alarm must transition into the configured state.
6. Troubleshooting – Common Failures
Problem | What to check | Likely solution |
|---|---|---|
Email not received | Subscription status | Confirm the subscription |
Subscription remains Pending | Confirmation email | Check spam/junk and confirm |
SNS message not delivered | Topic and endpoint | Verify topic ARN and endpoint |
CloudWatch alarm sends no email | Alarm state and actions | Check SNS action is configured for the intended state |
Alarm is not triggered | Metric and threshold | Verify metric, period, threshold, and incoming data |
Lambda does not receive messages | Lambda resource permissions | Verify SNS is allowed to invoke the function |
Messages are missing after delivery failures | Subscription DLQ | Inspect the SQS dead-letter queue |
Controlled failure tests:
- Create an email subscription but do not confirm it. Publish a message and observe why the email endpoint does not receive notifications.
- Temporarily configure an alarm threshold that your test instance does not reach. Observe why the alarm remains in
OKrather than enteringALARM.
7. Important Exam Revision
Concept | Remember |
|---|---|
SNS Topic | Message distribution channel |
Publisher | Sends messages to a topic |
Subscriber | Receives messages |
Standard | No strict ordering; duplicates are possible |
FIFO | Ordered messages and deduplication |
Subscription confirmation | Required for applicable endpoints |
Filter Policy | Controls which messages a subscriber receives |
DLQ | Stores messages that could not be delivered successfully |
CloudWatch + SNS | Sends notifications when configured alarm states are reached |
SNS vs SQS vs EventBridge
Service | Primary purpose |
|---|---|
SNS | Publish messages and distribute them to subscribers |
SQS | Store messages in a queue until consumers process them |
EventBridge | Match events against rules and route them to targets |
Exam trap: SNS and SQS are not interchangeable. SNS pushes messages to subscribers; SQS provides a queue that consumers poll or process through supported integrations.
Also, CloudWatch alarms can publish directly to SNS. EventBridge is not mandatory for every alarm notification.
8. Decision Notebook
Before choosing SNS, ask:
- Do I need to notify multiple recipients from one publisher?
- Do I need email, SMS, Lambda, or SQS delivery?
- Do subscribers need different messages based on filters?
- Do I need ordered message processing? Consider FIFO and compatible SQS subscriptions.
- Do I need to investigate failed deliveries? Consider an SQS DLQ.
9. Cleanup
To avoid leaving unnecessary resources:
- Delete the CloudWatch alarm created for this demo.
- Delete the SNS subscription.
- Delete the SNS topic.
- Stop or terminate any temporary EC2 resources used for testing.
10. Official AWS Documentation
Next Skill: 1.1.6 – Continue with the next skill in the official AWS CloudOps Engineer Associate exam guide.
Series: My CloudOps Learning Journey (7 articles)
- …
- 6AWS CloudOps Learning Journey | Skill 1.1.5 – Configure and Manage Amazon Simple Notification Service (Amazon SNS) This article
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article