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

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.
主站蜘蛛池模板: 长汀县| 洪江市| 安塞县| 松江区| 淮滨县| 淄博市| 望奎县| 莆田市| 南开区| 车致| 开远市| 漳平市| 万全县| 高州市| 洞头县| 湟源县| 将乐县| 兴安县| 南京市| 衡南县| 邯郸县| 巧家县| 磴口县| 二连浩特市| 乌审旗| 井研县| 科技| 无棣县| 苗栗市| 东港市| 江都市| 三门峡市| 陇南市| 敖汉旗| 永年县| 连南| 左权县| 文安县| 聂荣县| 华阴市| 台北市|