• Guide Content

SNS Monitoring: 5 Key Metrics & How to Monitor with CloudWatch

What Is AWS SNS Monitoring?

Amazon Simple Notification Service (SNS) manages message delivery. SNS monitoring involves tracking and analyzing AWS SNS’s operational metrics to ensure optimal performance and high reliability and efficiency. 

Monitoring tools like AWS CloudWatch allow administrators to observe various metrics such as message delivery success rates, the number of messages published, and the throughput of notifications across different channels. Effective monitoring helps proactive management by alerting admins about potential issues before they affect communication processes.

By monitoring SNS messaging, organizations can fine-tune their notification strategies, maintain compliance with expected service levels, and minimize disruptions in message delivery. It also provides insights into usage patterns and performance trends, assisting in capacity planning and operational scaling. 

This is part of a series of articles about AWS SNS.

The Importance of Monitoring AWS SNS 

Monitoring SNS allows organizations to track the reliability and effectiveness of communication systems built on AWS infrastructure. Timely detection and resolution of issues such as delayed messages or failed deliveries ensure that notifications and alerts reach their intended recipients without interruption. 

This is particularly important for applications that rely on immediate notifications for operational functionality, such as incident alert systems, real-time event monitoring, or transaction alerts in financial services.

SNS monitoring also helps in cost management by analyzing usage patterns and identifying inefficiencies or unnecessary expenses in the notification services. For example, by tracking metrics like PublishSize and SMSSuccessRate, organizations can adjust their message formats and delivery methods to optimize costs while maintaining service quality. 

What Is AWS CloudWatch? 

CloudWatch is a monitoring and observability service from Amazon Web Services that provides data and actionable insights to monitor applications, respond to system-wide performance changes, and optimize resource utilization. It collects monitoring and operational data in logs, metrics, and events, providing a unified view of AWS resources, applications, and services, including AWS SNS.

CloudWatch enables developers, system operators, and IT managers to understand their AWS environments better to maintain operational health. Using AWS CloudWatch, users can set up dashboards to visualize metrics and logs, set alarms to watch for specific conditions and react automatically to changes in their AWS environments. 

CloudWatch enhances application performance and keeps systems running smoothly. It also allows for immediate and automatic responses to detected changes in the system’s performance or operational control. 

Key AWS SNS Metrics 

CloudWatch can be used to track several metrics in SNS.

1. NumberOfMessagesPublished

This metric tracks the number of messages sent to subscribers over a given period. It helps assess the communication frequency and effectiveness of the notifications, identifying trends or issues in message dispatch. Analyzing disruptions or unusual spikes in the number of published messages can help diagnose problems in the system or detect unintended behavior.

2. NumberOfNotificationsDelivered

This metric counts how many messages have been successfully delivered to subscribers. It aids in ensuring that the notifications reach the intended recipients. It also helps identify deliverability issues that indicate problems like recipient blacklisting or network issues. A drop in this metric may suggest a message distribution bottleneck or failure.

3. PublishSize

This metric measures the size of messages sent through SNS (in data). It helps with managing the data throughput of the system, ensuring optimal performance, and avoiding overage costs. It’s also useful for understanding and forecasting system load. Organizations can optimize their usage patterns and message structures by analyzing the trends in message sizes.

4. SMSSuccessRate

This metric helps monitor the percentage of SMS messages successfully sent and delivered to recipients. It aids in evaluating the reliability and efficiency of SMS communication infrastructures deployed via SNS. Fluctuations in the success rate can indicate issues such as carrier-level problems and content-related rejections.

5. ApproximateNumberOfTopics

This metric indicates the total number of topics created within an SNS environment. Topics act as pub/sub-communication channels, so this metric provides insight into the scale and scope of usage. It is also useful in resource management and capacity planning. The number of active topics can inform how the SNS architecture might support anticipated workloads.

Tutorial: Monitor SNS Topics with CloudWatch 

Integrating SNS with CloudWatch allows you to collect and understand metrics for SNS notifications. Here’s an overview of how to implement this setup.

Viewing CloudWatch Metrics for Amazon SNS

To monitor metrics for SNS, you can use the AWS CloudWatch console, the CloudWatch command line interface (CLI), or the CloudWatch API. Here, we look at how to access these metrics through the AWS CloudWatch Console:

  1. Log into the CloudWatch console and navigate to Metrics.
  2. To select the metric’s category, click SNS on the All metrics tab. You will see various dimensions to choose from, such as Country, SMS Type, PhoneNumber, Topic Metrics, and Metrics with no dimensions.
  3. For more detailed insights, select an item. If you choose Topic Metrics and then NumberOfMessagesPublished, you will see the average number of Amazon SNS messages published over a 1-minute period, displayed across a 6-hour range.
  4. To check usage statistics, go to the All metrics tab, click on Usage, and select the specific SNS usage metric you are interested in, like NumberOfMessagesPublishedPerAccount.

Setting a CloudWatch Alarm for SNS Metrics

Alarms in CloudWatch help you proactively manage and respond to conditions in SNS. Here’s how you can set up an alarm:

  1. Log into the AWS Management Console and open the CloudWatch console.
  2. Navigate to Alarms, then click on the Create Alarm button to start the alarm creation wizard.
  3. Browse through the list of SNS metrics, select the metric you wish to monitor, and click Continue.
  4. To configure the alarm’s settings, enter details such as the alarm name, description, threshold, and timing. Proceed by selecting Continue.
  5. To set the notification options, select Alarm as the desired state for notifications. To receive email notifications, either link to an existing SNS topic or create a new one. If creating a new email topic, input the name and email address to be notified.
  6. Note that any new email addresses must be verified before receiving notifications. Ensure these are verified to avoid missed alerts.
  7. Review your configurations and use the Edit links if adjustments are needed. Once everything is set, click on Create Alarm.

Advanced AWS SNS Monitoring with Lumigo

Lumigo is a cloud-native observability and troubleshooting tool. Lumigo automatically enriches traces with complete in-context request and response payloads and correlates them to the appropriate logs and metrics. This unified view of all troubleshooting data enables users to solve cloud native issues 80% faster than similar tools. With Lumigo, users can:

  • See the end-to-end path of a transaction and full system map of applications
  • Monitor and debug third-party APIs and managed services (ex. Amazon DynamoDB, Twilio, Stripe)
  • Go from alert to root cause analysis in one click
  • Understand system behavior and explore performance and cost issues 
  • Group services into business contexts

Get started with a free trial of Lumigo for your microservice applications.