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

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.
主站蜘蛛池模板: 墨脱县| 青浦区| 中超| 台前县| 分宜县| 夏河县| 德格县| 穆棱市| 定兴县| 宣威市| 新余市| 周至县| 略阳县| 鹿邑县| 清徐县| 柳州市| 扶余县| 广南县| 新昌县| 长宁县| 广汉市| 环江| 大安市| 樟树市| 铜川市| 秀山| 曲阳县| 社会| 鄂尔多斯市| 永靖县| 徐州市| 衡阳县| 沾益县| 仁化县| 正安县| 五常市| 合肥市| 巴林左旗| 信丰县| 宝丰县| 靖宇县|