官术网_书友最值得收藏!

Amazon SNS

Amazon Simple Notification Service (SNS) implements the publish-subscribe messaging pattern. When you create an SNS topic, it becomes available for other services to subscribe to it. If someone publishes a message in this topic, all subscribed services will be alerted.

It's a very simple and powerful service. You can use it to dynamically attach different services that are able to handle a specific kind of notification. For example, an application can send a notification to an SNS topic to alert that you have received a new file to process. You can subscribe to this topic using an HTTP endpoint and SNS will send a message to your web service with the file location that needs processing. Later, you can add another endpoint, using a Lambda function programmed to do another kind of processing.

Let's perform the following steps to create a simple demo using the CLI as an example:

  1. Create an SNS topic using the following command line:
        aws sns create-topic --name email-alerts
  1. The result is an Amazon Resource Name (ARN) that you need to save. The ARN will be created with a format of this example: arn:aws:sns:us-east-1:1234567890:email-alerts
  2. Subscribe to a topic using the e-mail protocol, so you will receive an e-mail every time that an application publishes to this topic:
        aws sns subscribe --topic-arn the_previous_arn --protocol email \
--notification-endpoint myemail@example.com
  1. Open your e-mail account and confirm that you want to subscribe to events.
  2. Publish a test message and see it working by using the following command line:
        aws sns publish --topic-arn the_previous_arn --message "test"
For more commands, refer to the official guide at http://docs.aws.amazon.com/cli/latest/userguide/cli-sqs-queue-sns-topic.html.
主站蜘蛛池模板: 娄烦县| 吉隆县| 拜泉县| 金平| 海丰县| 军事| 绥化市| 新丰县| 应用必备| 上虞市| 浠水县| 乐至县| 刚察县| 白银市| 明水县| 莱阳市| 阳谷县| 深圳市| 阿坝县| 驻马店市| 威宁| 前郭尔| 天祝| 临西县| 深水埗区| 吉木乃县| 廉江市| 广德县| 博野县| 黔江区| 沁源县| 荔波县| 临邑县| 积石山| 潜江市| 吉首市| 门头沟区| 南昌县| 蒲江县| 呼和浩特市| 雷山县|