Application Integration
    🔗Application Integration

    Amazon SNS

    Pub/sub messaging and mobile push notification service

    SNS is like a radio station that broadcasts messages to multiple listeners simultaneously. Instead of sending the same message to 10 different systems individually, you publish it once to an SNS topic, and all subscribers receive it automatically. Subscribers can be email addresses, phone numbers (SMS), Lambda functions, SQS queues, or HTTP endpoints. It's perfect for fan-out scenarios: one event triggers multiple actions. Think of it as a megaphone that announces news to everyone who's interested, whether they're listening via email, text, or application.

    SNS uses a pub/sub model: publishers send messages to topics, and subscribers receive messages from topics. Topics support multiple subscription types: email, SMS, HTTP/HTTPS, Lambda, SQS, mobile push (iOS, Android), and Kinesis Data Firehose.

    Key Capabilities

    Key features: message filtering (subscribers receive only messages matching filter policies), message attributes (metadata for routing), FIFO topics (ordered delivery to SQS FIFO queues), and delivery retries (exponential backoff).

    Gotchas & Constraints

    Gotcha #1: SNS delivers messages at-least-once; subscribers must handle duplicates. Gotcha #2: SMS costs vary by country and can be expensive; use SNS budgets to control costs. Constraints: Maximum 256KB message size, maximum 12.5 million subscriptions per topic, and FIFO topics limited to 3,000 messages/second per topic (or 300 per message group).

    A monitoring system detects a critical production issue: database CPU at 95%. They need to alert the on-call engineer (SMS), post to Slack (HTTP webhook), create a ticket in Jira (Lambda function), and log to S3 (SQS queue to Lambda). Instead of implementing each notification separately, they publish one message to an SNS topic with four subscriptions: SMS to on-call phone, HTTPS to Slack webhook, Lambda function to create Jira ticket, and SQS queue for S3 logging. When the alert fires, all four actions happen simultaneously. They use message filtering: only 'critical' severity alerts trigger SMS (to avoid alert fatigue), but all alerts go to Slack and Jira. During a major outage, 100 alerts fire in 5 minutes; SNS delivers all notifications reliably, and the team responds immediately. They later add a fifth subscription (email to management) without changing the alerting code.

    The Result

    flexible notification system, easy to extend, and reliable delivery.

    Official AWS Documentation