⚡ ~/naveed Interview Prep
⚡ Portfolio Home 👤 About Naveed Bio & Credentials 📫 Contact Naveed Get In Touch ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All AWS & Cloud Architecture Interview Questions Scenario 57 of 179 in AWS & Cloud Architecture
Senior DevOps / SRE [L2] AWS Cost & Architecture Production Scenario [L2]
🎯 Target Role / Context: AWS Scenario #55 (L2) · Cost & Architecture

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.

#AWS #Cost & Architecture #L2 #Cloud #Infrastructure
🎙️ Candidate Opening & Architectural Context
"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."
Advertisement
⚡ Recommended Practice Lab

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.

1️⃣

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 publish returns a MessageId on success. An authorization or KMS error here means the problem is on the publisher side.
  • Topic metrics: in CloudWatch check NumberOfMessagesPublished, NumberOfNotificationsDelivered, NumberOfNotificationsFailed and NumberOfNotificationsFilteredOut for 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.
2️⃣

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-topic shows PendingConfirmation for unconfirmed email, HTTP and HTTPS endpoints. Unconfirmed subscriptions receive nothing.
  • Filter policy: aws sns get-subscription-attributes reveals FilterPolicy and FilterPolicyScope. By default the policy matches message attributes; with MessageBody scope it matches the JSON body instead.
  • Attributes must be set: publishers must send the attributes the filter expects, with the right data type (String or Number). 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.
Advertisement
3️⃣

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:SendMessage from principal sns.amazonaws.com, ideally with an aws:SourceArn condition equal to the topic ARN.
  • Lambda: add a resource-based permission with aws lambda add-permission for principal sns.amazonaws.com and 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:GenerateDataKey and kms:Decrypt). The AWS managed aws/sns key 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.
4️⃣

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.
Pro Tip: Attach a subscription-level dead-letter queue via <code>RedrivePolicy</code>. It turns silent drops into inspectable messages.
5️⃣

Prevention and automation

Make delivery observable before the next outage.

  • Alarms: alarm on NumberOfNotificationsFailed greater 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.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Pro-Tip: Compare <code>NumberOfMessagesPublished</code>, <code>NumberOfNotificationsFilteredOut</code> and <code>NumberOfNotificationsFailed</code> first; the one that moved tells you whether to look at filters, permissions or the endpoint."
⚡ 60-Second Elevator Pitch Talking Points
  • 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.
⛔ Critical Candidate Mistakes to Avoid in This Scenario

Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:

  1. 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.
  2. Forgetting the SQS queue policy for the SNS principal SNS cannot send to the queue, and the subscription looks fine in the console.
  3. 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.
  4. Publishing without the attributes the filter policy expects Messages are silently filtered out and counted in <code>NumberOfNotificationsFilteredOut</code>.
Advertisement
Want more AWS & Cloud Architecture scenarios?
Explore our complete collection of scenario-based AWS & Cloud Architecture interview runbooks.
Browse All AWS & Cloud Architecture Questions →