1 00:00:00,080 --> 00:00:02,180 ‫So here is a very cool new feature 2 00:00:02,180 --> 00:00:06,630 ‫from November 2019, called Lambda Destinations. 3 00:00:06,630 --> 00:00:08,995 ‫So, the problem is that, when we've been doing 4 00:00:08,995 --> 00:00:11,810 ‫asynchronous invocations or event mappers, 5 00:00:11,810 --> 00:00:13,615 ‫it was really hard for us to see 6 00:00:13,615 --> 00:00:15,728 ‫if it had failed or succeeded. 7 00:00:15,728 --> 00:00:18,510 ‫And if it did, to retrieve the data. 8 00:00:18,510 --> 00:00:21,920 ‫So the idea with destinations is to send the result 9 00:00:21,920 --> 00:00:25,002 ‫of an asynchronous invocation or the failure 10 00:00:25,002 --> 00:00:27,867 ‫of an event mapper into somewhere. 11 00:00:27,867 --> 00:00:28,880 ‫So where is that somewhere? 12 00:00:28,880 --> 00:00:29,930 ‫We'll see in a second. 13 00:00:29,930 --> 00:00:31,509 ‫So for asynchronous invocation, 14 00:00:31,509 --> 00:00:33,630 ‫we can define a destination for 15 00:00:33,630 --> 00:00:35,780 ‫both successful and failed events. 16 00:00:35,780 --> 00:00:36,860 ‫And by successful and failed, 17 00:00:36,860 --> 00:00:38,974 ‫we mean the processing of that event. 18 00:00:38,974 --> 00:00:40,889 ‫So for asynchronous invocations, 19 00:00:40,889 --> 00:00:44,673 ‫we have the destination of SQS, SNS, Lambda, 20 00:00:44,673 --> 00:00:48,326 ‫and the Amazon EventBridge bus, so cloud watch events. 21 00:00:48,326 --> 00:00:50,729 ‫The idea is that our lambda function 22 00:00:50,729 --> 00:00:53,100 ‫is invoked asynchronously for example, 23 00:00:53,100 --> 00:00:54,439 ‫through an S3 event. 24 00:00:54,439 --> 00:00:57,610 ‫And if we succeed we can send this somewhere 25 00:00:57,610 --> 00:00:59,490 ‫to successful event destination. 26 00:00:59,490 --> 00:01:02,897 ‫And if we fail we can send it to failed event destination. 27 00:01:02,897 --> 00:01:05,960 ‫So you may note right now that this looks a lot like 28 00:01:05,960 --> 00:01:08,830 ‫the DLQ setting for asynchronous invocations. 29 00:01:08,830 --> 00:01:12,370 ‫And so the recommendation now is that you use destinations 30 00:01:12,370 --> 00:01:13,640 ‫instead of the DLQ, 31 00:01:13,640 --> 00:01:15,930 ‫even though you can use both at the same time. 32 00:01:15,930 --> 00:01:16,763 ‫Why? 33 00:01:16,763 --> 00:01:18,606 ‫Well because the destinations are newer, 34 00:01:18,606 --> 00:01:21,350 ‫and they allow for more targets. 35 00:01:21,350 --> 00:01:25,030 ‫The DLQ just allows it to send the failures 36 00:01:25,030 --> 00:01:26,357 ‫into SQS and SNS, 37 00:01:26,357 --> 00:01:30,105 ‫but the destinations allow to send both the successes 38 00:01:30,105 --> 00:01:35,105 ‫and the failures into SQS, SNS, Lambda, and EventBridge. 39 00:01:35,250 --> 00:01:37,463 ‫Okay, that's for asynchronous invocations. 40 00:01:37,463 --> 00:01:39,323 ‫Now what about Event Source mapping? 41 00:01:39,323 --> 00:01:42,103 ‫This is only used for when you have an event batch 42 00:01:42,103 --> 00:01:44,881 ‫that gets discarded because we can't process it. 43 00:01:44,881 --> 00:01:49,091 ‫So we can, instead, send that event batch into Amazon SQS 44 00:01:49,091 --> 00:01:50,970 ‫or Amazon SNS, 45 00:01:50,970 --> 00:01:53,770 ‫which is represented by this diagram right here. 46 00:01:53,770 --> 00:01:55,030 ‫So we are reading from Kinesis, 47 00:01:55,030 --> 00:01:56,620 ‫there will be an Event Source mapping, 48 00:01:56,620 --> 00:01:58,833 ‫and we will try to keep on processing the data, 49 00:01:58,833 --> 00:02:01,469 ‫but then we don't succeed and instead of blocking 50 00:02:01,469 --> 00:02:04,214 ‫our entire processing of the Kinesis Data Stream, 51 00:02:04,214 --> 00:02:08,020 ‫we can send the discarded event batch into your 52 00:02:08,020 --> 00:02:10,070 ‫failed event destination. 53 00:02:10,070 --> 00:02:12,890 ‫And so please note that if you have an Event Source 54 00:02:12,890 --> 00:02:14,292 ‫mapping reading from SQS, 55 00:02:14,292 --> 00:02:18,050 ‫you can set either a failed destination or you can set up 56 00:02:18,050 --> 00:02:19,959 ‫a DLQ directly on your SQS Que. 57 00:02:19,959 --> 00:02:22,282 ‫It's up to you on how you want to do things. 58 00:02:22,282 --> 00:02:23,550 ‫So in the next lecture, 59 00:02:23,550 --> 00:02:25,870 ‫we'll go into destinations, do some hands on, 60 00:02:25,870 --> 00:02:27,180 ‫and get some practice to make 61 00:02:27,180 --> 00:02:28,660 ‫more sense out of this feature. 62 00:02:28,660 --> 00:02:30,560 ‫So I will see you in the next lecture.