ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

服务 · 应用程序集成

Amazon Simple Notification Service (Amazon SNS)

Publish a message once, and SNS pushes it to every subscriber: queues, functions, apps, phones and email.

本课尚未翻译,暂以英文显示。

Order app (publisher)
SNS
SQSLambda
People, by SMS, push or email
  1. 1The order app publishes one message, “order placed”, to an SNS topic.
  2. 2SNS pushes a copy to every subscriber at the same time: a queue for the warehouse, a Lambda function that writes the invoice, and a text message to the customer.
Fan-out: one message published to a topic reaches every subscriber.

分步说明

  1. 1The order app publishes one message, “order placed”, to an SNS topic.
  2. 2SNS pushes a copy to every subscriber at the same time: a queue for the warehouse, a Lambda function that writes the invoice, and a text message to the customer.
EC2CloudWatch
SNS
On-call team
  1. 1An EC2 instance sends its CPU use to Amazon CloudWatch.
  2. 2A CloudWatch alarm goes off when the CPU use stays too high, and publishes a message to an SNS topic.
  3. 3SNS sends an email and a text message to everyone who subscribed to the topic.
An alert: a CloudWatch alarm uses SNS to reach the on-call team.

分步说明

  1. 1An EC2 instance sends its CPU use to Amazon CloudWatch.
  2. 2A CloudWatch alarm goes off when the CPU use stays too high, and publishes a message to an SNS topic.
  3. 3SNS sends an email and a text message to everyone who subscribed to the topic.

An alert: a CloudWatch alarm uses SNS to reach the on-call team.

是什么

Amazon Simple Notification Service (Amazon SNS) is a fully managed publish and subscribe (pub/sub) messaging service. A publisher sends a message to a topic. SNS then pushes a copy to every subscriber of that topic straight away. The publisher does not need to know who the subscribers are.

Subscribers can be applications or people. Applications receive messages through Amazon SQS queues, AWS Lambda functions or HTTPS endpoints. People receive them as text messages (SMS), mobile push notifications or email. Sending one message to several subscribers at once is called fan-out.

是什么

SNS is the usual way to send alerts on AWS. For example, an Amazon CloudWatch alarm publishes to an SNS topic, and SNS emails and texts the people on call.

要记住

  • Push model: SNS delivers each message as soon as it is published.
  • One message, many subscribers. This is called fan-out.
  • Subscribers: SQS queues, Lambda functions, HTTPS endpoints, email, SMS and mobile push.
  • Unlike a queue, SNS does not hold messages for subscribers to collect later. Subscribe an SQS queue when a system must not miss any.

要记住

  • Filter policies let each subscriber receive only the messages it needs.
  • SNS email is plain text for alerts. For receipts and newsletters to customers, use Amazon SES.

考试中

  • “Notify many subscribers when something happens” or “send an SMS or email alert” points to Amazon SNS.
  • “Alert the operations team when CPU use is too high” points to an Amazon CloudWatch alarm that publishes to SNS.
  • “Send each order to several queues, so different systems can process it” points to SNS fan-out to SQS.