Amazon SNS (Simple Notification Service)
7 questions foundWhat is Amazon SNS and how does the publish subscribe messaging pattern work?
Beginner Amazon SNS is a fully managed pub or sub messaging service that lets a publisher send a single message to a topic, which then automatically delivers that message to every subscriber currently attached to that topic, such as email addresses, SMS numbers, SQS queues, or Lambda functions, allowing you to fan out a single event to many different destinations without the publisher needing to know anything about who is subscribed.
aws sns publish --topic-arn arn:aws:sns:us-east-1:123456789012:OrderAlerts --message 'New order received'
Real-world example An online retailer publishes a single message to an SNS topic whenever a high value order is placed, and that one message is automatically delivered to the sales team's email, a Slack integration through Lambda, and a logging Lambda function all at once.
Common follow-ups: What is the difference between SNS and SQS?;How many subscribers can a single SNS topic support?
Amazon SQS (Simple Queue Service);Amazon EventBridge
What types of endpoints can subscribe to an SNS topic?
Beginner SNS supports a wide range of subscriber types including email and email JSON, SMS text messages, HTTP and HTTPS endpoints, SQS queues, Lambda functions, and mobile push notifications to platforms like Apple and Google, giving you a great deal of flexibility in how a single published message can trigger many different types of downstream actions.
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:123456789012:OrderAlerts --protocol email --notification-endpoint manager@example.com
Real-world example A monitoring system publishes critical alerts to an SNS topic that simultaneously sends an SMS text message to the on call engineer and triggers a Lambda function that logs the incident into a tracking system.
Common follow-ups: How do you confirm a subscription for email or SMS endpoints?;What is the message size limit for an SNS notification?
Lambda & Serverless;AWS CloudTrail & Auditing
What is the difference between SNS Standard and FIFO topics?
Intermediate SNS Standard topics offer high throughput and best effort ordering, meaning messages might occasionally be delivered out of order or more than once, which is acceptable for most notification use cases, while SNS FIFO topics guarantee strict message ordering and exactly once delivery to subscribed SQS FIFO queues, which is important for use cases like financial transaction notifications where processing order absolutely matters.
aws sns create-topic --name OrderEvents.fifo --attributes FifoTopic=true,ContentBasedDeduplication=true
Real-world example A banking application uses an SNS FIFO topic to ensure that account transaction notifications are always delivered and processed in the exact order they occurred, preventing a withdrawal notification from ever being processed before its corresponding deposit.
Common follow-ups: What are the throughput limitations of FIFO topics compared to Standard topics?;Can a FIFO topic have subscribers other than SQS FIFO queues?
Amazon SQS (Simple Queue Service);AWS Backup & Disaster Recovery
How does message filtering work in SNS to control which subscribers receive specific messages?
Intermediate SNS message filtering lets each subscriber attach a filter policy to their subscription, describing specific message attribute values they are interested in, so that a subscriber only receives messages matching their filter policy rather than every single message published to the topic, allowing multiple subscribers with very different interests to share the same topic efficiently.
aws sns set-subscription-attributes --subscription-arn arn:aws:sns:us-east-1:123456789012:OrderAlerts:abc123 --attribute-name FilterPolicy --attribute-value '{"order_type":["international"]}'
Real-world example A logistics company uses a single SNS topic for all order events, but a subscriber responsible only for international shipping sets a filter policy so it only receives notifications for orders with an international order type attribute.
Common follow-ups: What attributes can be used within a filter policy?;How does filtering affect the cost of using SNS?
Amazon EventBridge;Amazon SQS (Simple Queue Service)
How does SNS support mobile push notifications to applications on iOS and Android devices?
Intermediate SNS Mobile Push lets you send notifications directly to mobile applications by first registering your app with the appropriate push notification service, such as Apple Push Notification Service or Firebase Cloud Messaging, creating platform endpoints for each device, and then publishing messages either directly to individual device endpoints or to a topic that many devices are subscribed to, letting you notify one user or broadcast to your entire mobile user base.
aws sns create-platform-endpoint --platform-application-arn arn:aws:sns:us-east-1:123456789012:app/APNS/MyApp --token device-token-abc123
Real-world example A mobile shopping app uses SNS Mobile Push to send a personalized notification directly to a specific customer's phone when an item on their wish list goes on sale, while also using topic based broadcasts to announce major site wide promotions to all users.
Common follow-ups: What is the difference between publishing to a single endpoint versus a topic for mobile push?;How do you handle expired or invalid device tokens?
Lambda & Serverless;AWS Cost Management & Billing
How does SNS integrate with SQS in the fan out pattern to support multiple independent consumers of the same event?
Advanced In the SNS to SQS fan out pattern, a single event is published once to an SNS topic, which then delivers a copy of that message to multiple separate SQS queues that are each subscribed to the topic, allowing multiple independent consumer applications to process the exact same event at their own pace, with each queue providing durability and retry handling independently, without one slow consumer affecting the others.
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:123456789012:OrderEvents --protocol sqs --notification-endpoint arn:aws:sqs:us-east-1:123456789012:InventoryQueue
Real-world example An order processing platform publishes a single order placed event to SNS, which fans it out to three separate SQS queues feeding independent inventory, shipping, and analytics services, each processing the event on its own schedule without interfering with the others.
Common follow-ups: What are the advantages of the fan out pattern compared to publishing directly to multiple queues?;How do you handle a message that fails processing in one of the fan out queues?
Amazon SQS (Simple Queue Service);Amazon EventBridge
What security controls are available to restrict who can publish to or subscribe from an SNS topic?
Advanced SNS topics support resource based access policies, similar to those used with S3 buckets, letting you precisely control which AWS accounts, IAM users, or services are allowed to publish messages to a topic or subscribe to it, and SNS also supports server side encryption using AWS KMS to protect message content at rest, ensuring sensitive notification data remains secure both in terms of access control and encryption.
aws sns set-topic-attributes --topic-arn arn:aws:sns:us-east-1:123456789012:SensitiveAlerts --attribute-name Policy --attribute-value file://topic-policy.json
Real-world example A healthcare application restricts its SNS topic policy so that only a specific application role can publish patient related alert messages, while enabling KMS encryption to ensure the message content remains protected at rest.
Common follow-ups: How do you write an SNS topic policy that restricts access to a specific IAM role?;What is the performance impact of enabling KMS encryption on an SNS topic?
IAM;AWS KMS & Data Encryption