Amazon SNS のアイコン

Amazon SNS Essential2009年〜

A fully managed Pub/Sub messaging and notification service

What It Does

Amazon SNS (Simple Notification Service) is a publish/subscribe (Pub/Sub) messaging service. A single message can be simultaneously delivered to multiple subscribers (SQS queues, Lambda functions, HTTP endpoints, email, SMS, etc.). It's ideal for message fan-out (one-to-many delivery).

Use Cases

Application alert notifications, event fan-out between microservices, mobile push notifications, SMS-based two-factor authentication, and email notifications for system failures.

Everyday Analogy

Think of a building PA system. When you make an announcement from the broadcast room (publisher), it reaches speakers (subscribers) on every floor simultaneously. You can also broadcast to specific floors only (message filtering).

What Is SNS?

Amazon SNS is a Pub/Sub service that delivers messages to multiple destinations simultaneously. When you publish a message to a channel called a topic, it's delivered to all subscribers of that topic. While SQS is suited for one-to-one communication, SNS is designed for one-to-many communication.

Topic Types and Filtering

SNS offers Standard topics and FIFO topics. Standard topics provide virtually unlimited throughput. FIFO topics guarantee message ordering and deduplication, used in combination with SQS FIFO queues. Subscription filter policies let you deliver messages only to specific subscribers based on message attributes. For real-world examples and best practices on topic types and filtering, books on Amazon are a useful reference.

Getting Started

In the SNS console, select "Create topic" and specify a topic name. Create subscriptions by specifying the protocol (Email, SQS, Lambda, etc.) and endpoint. Publish messages to the topic via the AWS SDK, and they're delivered to all subscribers. The always-free tier includes 1 million publishes per month.

Things to Watch Out For

  • Standard topics don't guarantee message ordering - use FIFO topics when order matters
  • SMS costs vary significantly by country/region. Verify costs before sending at scale
  • The always-free tier includes 1 million publishes, 100,000 HTTP deliveries, and 1,000 email deliveries per month
共有するXB!