Q: SNS topic notification not being received.
When an SNS topic notification is not being received, work the path in order: was the message published, is the subscription confirmed, does a filter policy drop it, can SNS actually deliver to the endpoint, and is it failing.
Want to master this scenario in a live sandbox? Stephane Maarek's AWS Certified DevOps Engineer Professional Masterclass on Udemy covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: When an <strong>SNS topic notification is not being received</strong>, work the path in order: was the message published, is the subscription confirmed, does a filter policy drop it, can SNS actually deliver to the endpoint, and is it failing silently after delivery. SNS reports success for a publish regardless of what happens next, so you need metrics and delivery logs to find the break. Interviewers use this to test whether you can use CloudWatch evidence, IAM and resource policies, and encryption keys to isolate a messaging failure methodically.
Symptom: confirm the message was published and counted
Split the problem in half: did SNS accept the message, and did SNS deliver it?
aws sns publish --topic-arn arn:aws:sns:us-east-1:123456789012:alerts \
--message "test" --subject "diag"
aws cloudwatch get-metric-statistics --namespace AWS/SNS \
--metric-name NumberOfNotificationsFailed \
--dimensions Name=TopicName,Value=alerts \
--start-time $(date -u -v-1H +%FT%TZ) --end-time $(date -u +%FT%TZ) \
--period 300 --statistics Sum
- Publish result:
aws sns publishreturns aMessageIdon success. An authorization or KMS error here means the problem is on the publisher side. - Topic metrics: in CloudWatch check
NumberOfMessagesPublished,NumberOfNotificationsDelivered,NumberOfNotificationsFailedandNumberOfNotificationsFilteredOutfor the topic. - Reading the pattern: published up but delivered flat points to subscriptions or filters; failed up points to endpoint permissions or availability.
- Right Region and ARN: confirm the publisher uses the topic ARN in the same Region; a typo creates confusion because a different topic may exist.
Hands-on: SNS topic notification not being received, check subscription and filters
Most real cases are an unconfirmed subscription or a filter policy that excludes the message.
aws sns list-subscriptions-by-topic \
--topic-arn arn:aws:sns:us-east-1:123456789012:alerts \
--query 'Subscriptions[].[Protocol,Endpoint,SubscriptionArn]' --output table
aws sns get-subscription-attributes --subscription-arn <arn> \
--query 'Attributes.[FilterPolicy,FilterPolicyScope,RawMessageDelivery,RedrivePolicy]'
- Subscription status:
aws sns list-subscriptions-by-topicshowsPendingConfirmationfor unconfirmed email, HTTP and HTTPS endpoints. Unconfirmed subscriptions receive nothing. - Filter policy:
aws sns get-subscription-attributesrevealsFilterPolicyandFilterPolicyScope. By default the policy matches message attributes; withMessageBodyscope it matches the JSON body instead. - Attributes must be set: publishers must send the attributes the filter expects, with the right data type (
StringorNumber). Missing attributes mean the message is filtered out. - Raw message delivery: for SQS and HTTP endpoints, this changes the payload format. A consumer expecting the SNS JSON envelope will fail to parse a raw message, and vice versa.
- FIFO topics: FIFO topics only deliver to SQS queues, and the message group and deduplication settings can cause a message to be treated as a duplicate and dropped within the deduplication window.
Permissions: SQS, Lambda and KMS
SNS needs explicit permission to deliver to cross-service endpoints, and encryption adds another policy.
aws sqs get-queue-attributes --queue-url <url> --attribute-names Policy
aws lambda add-permission --function-name my-fn \
--statement-id sns-invoke --action lambda:InvokeFunction \
--principal sns.amazonaws.com \
--source-arn arn:aws:sns:us-east-1:123456789012:alerts
- SQS queue policy: the queue must allow
sqs:SendMessagefrom principalsns.amazonaws.com, ideally with anaws:SourceArncondition equal to the topic ARN. - Lambda: add a resource-based permission with
aws lambda add-permissionfor principalsns.amazonaws.comand the topic as source ARN; otherwise invocations are denied. - Encrypted topic or queue: if you use a customer managed KMS key, its key policy must allow SNS to use it (and the publisher to
kms:GenerateDataKeyandkms:Decrypt). The AWS managedaws/snskey cannot be extended to grant other services access. - Cross-account: the topic policy must allow the other account to subscribe, and the endpoint's own policy must allow SNS to deliver.
Delivery status logs, retries and protocol-specific causes
When metrics show failures, delivery status logging tells you why.
- Delivery status logging: enable it per protocol (Lambda, SQS, HTTP and others) with an IAM role, then read the failures in CloudWatch Logs for the exact status and error message.
- HTTP and HTTPS: endpoints must return a 2xx response and be reachable from the internet. Failed deliveries retry according to the delivery policy, then are dropped unless a DLQ is set.
- Email: confirm the subscription, then check spam and filters. Corporate mail systems often quarantine messages from
no-reply@sns.amazonaws.com. - SMS: new accounts can be in the SMS sandbox with verified destinations only, and recipients who opted out will not receive messages. Check account SMS settings and spending limits.
Prevention and automation
Make delivery observable before the next outage.
- Alarms: alarm on
NumberOfNotificationsFailedgreater than zero and on DLQ depth. - Infrastructure as code: define the topic, subscriptions, queue policy and KMS grants together in Terraform so permissions never drift apart.
- Synthetic test: publish a heartbeat message on a schedule and alarm if the consumer does not record it.
- Idempotent consumers: SNS standard topics deliver at least once, so consumers should tolerate duplicates and not treat missing duplicates as errors.
- Runbook link: keep this checklist next to the alarm so on-call engineers check subscription status, filter policy, permissions, then delivery logs in the same order every time.
- SNS accepts a publish independently of delivery, so I split the problem using the topic's published, filtered-out, delivered and failed metrics.
- I check subscription confirmation, <code>FilterPolicy</code> and scope, queue or Lambda resource policies and KMS key policy, and read delivery status logs for the exact error.
- I prevent repeats with failure alarms, subscription DLQs and Terraform that defines topic, subscription and permissions together.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Assuming a successful <code>publish</code> means delivery SNS returns a MessageId before delivery happens; failures and filtering are visible only in metrics and logs.
- Forgetting the SQS queue policy for the SNS principal SNS cannot send to the queue, and the subscription looks fine in the console.
- Using the AWS managed <code>aws/sns</code> key with cross-service subscribers You cannot edit its key policy to grant other services access; use a customer managed key.
- Publishing without the attributes the filter policy expects Messages are silently filtered out and counted in <code>NumberOfNotificationsFilteredOut</code>.