1 00:00:06,930 --> 00:00:10,190 - Now let's review the Amazon Simple Notification Service, 2 00:00:10,190 --> 00:00:11,730 or SNS. 3 00:00:11,730 --> 00:00:15,190 Now, with Amazon Simple Notification Service, or SNS, 4 00:00:15,190 --> 00:00:18,690 we have the ability to send notifications. 5 00:00:18,690 --> 00:00:22,980 And this is done through a publish/subscribe kind of model. 6 00:00:22,980 --> 00:00:26,760 These messages are pushed to wherever they're going. 7 00:00:26,760 --> 00:00:31,760 There's no need for another system to pull the service. 8 00:00:32,160 --> 00:00:34,100 In fact, it can't pull. 9 00:00:34,100 --> 00:00:36,290 And so again, these messages are pushed. 10 00:00:36,290 --> 00:00:39,720 And so the way SNS works is that we create, 11 00:00:39,720 --> 00:00:42,520 within the service, we create topics. 12 00:00:42,520 --> 00:00:45,510 And we then subscribe to those topics 13 00:00:45,510 --> 00:00:47,470 in a number of different ways. 14 00:00:47,470 --> 00:00:49,980 We can subscribe via email, 15 00:00:49,980 --> 00:00:52,760 we can choose to get a plain email, 16 00:00:52,760 --> 00:00:56,670 a plain text email or a JSON encoded email. 17 00:00:56,670 --> 00:01:01,630 We could subscribe HTTP or HTTP/S in points. 18 00:01:01,630 --> 00:01:03,290 Through text message. 19 00:01:03,290 --> 00:01:08,290 We could also subscribe simple Q service queues. 20 00:01:09,360 --> 00:01:12,100 to the Simple Notification Service Topics. 21 00:01:12,100 --> 00:01:17,100 So that as messages go into Simple Notification Service, 22 00:01:18,580 --> 00:01:21,690 that could then push them into a queue. 23 00:01:21,690 --> 00:01:23,070 That's a very powerful pattern, 24 00:01:23,070 --> 00:01:26,310 especially if you're using multiple queues. 25 00:01:26,310 --> 00:01:28,610 That pattern is called the fan out pattern, 26 00:01:28,610 --> 00:01:30,640 where one message goes through 27 00:01:30,640 --> 00:01:32,250 the Simple Notification Service, 28 00:01:32,250 --> 00:01:34,720 and then gets sent into multiple queues 29 00:01:35,700 --> 00:01:38,510 so that we can perform, perhaps, 30 00:01:38,510 --> 00:01:42,470 several different operations on the same message. 31 00:01:42,470 --> 00:01:46,420 We could also leverage Mobile Push notifications as well. 32 00:01:46,420 --> 00:01:48,890 Now, another important thing to keep in mind 33 00:01:48,890 --> 00:01:50,940 about the Simple Notification Service 34 00:01:50,940 --> 00:01:55,330 is that the order of messages is not guaranteed. 35 00:01:55,330 --> 00:01:57,450 So messages could very well 36 00:01:57,450 --> 00:02:00,230 reach wherever they're going out of order. 37 00:02:00,230 --> 00:02:02,610 Right, so if you do need some kind of 38 00:02:02,610 --> 00:02:04,440 order to those messages, 39 00:02:04,440 --> 00:02:07,600 then within the message you would have to include 40 00:02:07,600 --> 00:02:11,633 some kind of piece of data that indicates that order. 41 00:02:12,810 --> 00:02:15,230 It's also worth noting that messages 42 00:02:15,230 --> 00:02:18,490 are not stored in SNS. 43 00:02:18,490 --> 00:02:20,970 Right, so once a message has been 44 00:02:22,230 --> 00:02:25,250 sent through the topic and pushed to where it's going, 45 00:02:25,250 --> 00:02:28,350 it's gone, you're not going to retrieve it again. 46 00:02:28,350 --> 00:02:31,140 If it's been lost in cyberspace, 47 00:02:31,140 --> 00:02:33,470 then you'll have to resend it again. 48 00:02:33,470 --> 00:02:36,160 Now, HTTP and HTTP/S in points 49 00:02:36,160 --> 00:02:39,340 do have a built in retry, 50 00:02:39,340 --> 00:02:40,780 but that's still different than 51 00:02:40,780 --> 00:02:42,740 actually storing the messages. 52 00:02:42,740 --> 00:02:47,740 And so, Amazon SNS is an important service 53 00:02:48,700 --> 00:02:51,500 to take a look at and get to know, 54 00:02:51,500 --> 00:02:54,920 because it does play a very key role, 55 00:02:55,792 --> 00:02:58,640 a very central role in a number of architectures, 56 00:02:58,640 --> 00:03:00,890 especially when it comes to monitoring 57 00:03:01,860 --> 00:03:05,640 and alerting you as to issues that may be going on. 58 00:03:05,640 --> 00:03:07,510 As you've seen throughout things 59 00:03:07,510 --> 00:03:09,360 that we've already talked about, 60 00:03:09,360 --> 00:03:11,600 Simple Notification Service is used 61 00:03:11,600 --> 00:03:13,950 by a number of other services 62 00:03:13,950 --> 00:03:17,800 to inform you of things happening within your environment. 63 00:03:17,800 --> 00:03:21,490 So, like we've seen earlier on, 64 00:03:21,490 --> 00:03:24,660 we can leverage Simple Notification Service 65 00:03:24,660 --> 00:03:26,310 with Amazon Cloud Watch, 66 00:03:26,310 --> 00:03:29,450 so that alarms can send a notifications, 67 00:03:29,450 --> 00:03:31,563 other services like AWS Config, 68 00:03:32,460 --> 00:03:36,250 and Code Pipeline and Cloud Formation, 69 00:03:36,250 --> 00:03:39,000 so that we can receive notifications 70 00:03:39,000 --> 00:03:41,530 as changes are made to our environment, 71 00:03:41,530 --> 00:03:44,010 and as other automated processes 72 00:03:44,010 --> 00:03:47,030 move through their life cycle of events. 73 00:03:47,030 --> 00:03:49,072 So again, keep in mind that 74 00:03:49,072 --> 00:03:51,140 when it comes to notifications, 75 00:03:51,140 --> 00:03:55,390 especially notifications about your Amazon Environment, 76 00:03:55,390 --> 00:03:58,480 Amazon Simple Notification Service, or SNS 77 00:03:58,480 --> 00:04:01,630 is a key service to be, not only aware of, 78 00:04:01,630 --> 00:04:03,253 but very familiar with.