Delivering Operational Notifications with Amazon SNS
This lesson covers configuring services to publish to Amazon SNS, which carries alarm notifications and service events to people and automation, and troubleshooting delivery.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish standard and FIFO topics and subscription types.
- Identify the services that publish to SNS.
- Configure topic access policies and KMS encryption.
- Troubleshoot missing notifications.
Topics and subscriptions
A standard topic delivers each message to all subscriptions, in no guaranteed order; a FIFO topic preserves order and deduplicates but only delivers to SQS queues. Subscription protocols include email and email-JSON, SMS, HTTP and HTTPS endpoints, SQS queues, Lambda functions, Amazon Data Firehose and mobile push. Email and HTTP subscriptions must be confirmed before they receive messages; an unconfirmed email subscription is the most common reason why an operator receives nothing. A subscription filter policy delivers only messages whose attributes (or body) match, so one topic can serve teams with different interests.
Which subscription?
Services that publish to SNS
Many AWS services can publish notifications to an SNS topic directly, which is often the least-effort way to inform people. The following table lists the most common sources in operations scenarios.
| Source | What it sends |
|---|---|
| CloudWatch alarms | State changes of metric and composite alarms |
| EC2 Auto Scaling | Instance launch, termination and failed launch or termination |
| RDS event subscriptions | Failover, maintenance, backup, configuration and low-storage events |
| CloudFormation | Stack events during create, update and delete |
| AWS Backup | Backup, copy and restore job events from a vault |
| S3 Event Notifications | Object created, removed, restored and replication events |
| AWS Config | Configuration item and compliance change notifications |
| Amazon EventBridge | Any matched event, through an SNS target |
Access policies and encryption
The topic's access policy is a resource-based policy that must allow the publishing principal. For AWS services this is a service principal such as events.amazonaws.com, s3.amazonaws.com or cloudwatch.amazonaws.com, scoped with aws:SourceArn or aws:SourceAccount so that only your resources can publish. When the console creates an S3 event notification or an EventBridge target, it usually adds this statement; when the CLI or infrastructure as code is used, it must be added explicitly.
Server-side encryption with KMS adds a second requirement. The publishing service must be able to use the key, so the topic must use a customer managed key whose key policy allows the service principal kms:GenerateDataKey* and kms:Decrypt. The AWS managed key alias/aws/sns has a fixed policy that does not allow other services, so CloudWatch alarms and EventBridge rules publishing to a topic encrypted with it fail silently.
{
"Sid": "AllowEventBridgePublish",
"Effect": "Allow",
"Principal": {"Service": "events.amazonaws.com"},
"Action": "sns:Publish",
"Resource": "arn:aws:sns:eu-west-1:111122223333:ops-alerts",
"Condition": {"ArnLike": {"aws:SourceArn": "arn:aws:events:eu-west-1:111122223333:rule/*"}}
}The following diagram compares a topic encrypted with a customer managed key with one using the AWS managed key.

Why is nothing published?
Troubleshooting missing notifications
After a security review encrypted every SNS topic, operators stopped receiving alarm emails, although the alarms still reach the ALARM state. The troubleshooting order is as follows.
-
Read the alarm history
Look for an action failure message.
-
Check the topic's key
If it is
alias/aws/sns, re-encrypt with a customer managed key. -
Allow CloudWatch in the key policy
Allow
cloudwatch.amazonaws.comto usekms:GenerateDataKey*andkms:Decrypt. -
Check the topic policy and subscriptions
Confirm the topic policy allows CloudWatch to publish and that subscriptions are confirmed.
-
Check subscriber-side delivery
Use SNS delivery status logging and the
NumberOfNotificationsFailedmetric.
Which condition should a topic policy use to limit publishing to one alarm or bucket?
Show answer
aws:SourceArn, which restricts the service principal to publishing on behalf of that specific resource.
Exam Tips
Remember for the exam
- Unconfirmed email subscriptions receive nothing.
- Services publishing to an encrypted topic need a customer managed KMS key that allows them.
- Topic access policies must allow the publishing service principal, ideally with aws:SourceArn.
- Use subscription filter policies to send different messages to different subscribers.
- Auto Scaling, RDS, CloudFormation, AWS Backup and S3 can all notify SNS directly.