1
00:00:00,300 --> 00:00:06,480
In this video, we are going to learn learn the asynchronous invocation and the Lambda Destinations.

2
00:00:06,750 --> 00:00:10,920
So far, we have seen that we can add trigger to lambda function.

3
00:00:11,010 --> 00:00:17,460
But now we also see on the right hand side, which is the eighth destination of our lambda function,

4
00:00:17,460 --> 00:00:19,420
which is the lambda destinations.

5
00:00:19,470 --> 00:00:25,620
We can see these triggers and destinations when creating a lambda function from the management console.

6
00:00:26,070 --> 00:00:27,030
Let me explain.

7
00:00:27,030 --> 00:00:28,590
What is Lambda destinations?

8
00:00:28,770 --> 00:00:30,660
Lambda can define destinations.

9
00:00:30,660 --> 00:00:32,520
One invoke asynchronous way.

10
00:00:32,520 --> 00:00:37,830
We can set destinations on success or on faith events after invocation is done.

11
00:00:38,280 --> 00:00:42,720
So we can also configure Lambda to send an invocation record to another services.

12
00:00:42,750 --> 00:00:46,890
Lambda supports the destinations for asynchronous invocation.

13
00:00:46,890 --> 00:00:48,700
You can see the image on the slide.

14
00:00:48,720 --> 00:00:57,390
So basically we can designate the incoming invocation to Amazon, asks Amazon Sass a lambda and event.

15
00:00:58,410 --> 00:01:02,520
So the invocation record contains details about the request and the response.

16
00:01:02,520 --> 00:01:08,810
In JSON format, we can configure separate destinations for events that are processed successfully and

17
00:01:08,820 --> 00:01:11,460
events that fail all processing attempts.

18
00:01:11,490 --> 00:01:18,360
Alternatively, we can configure an Amazon case or Amazon SMS topic as a data queue for discarded events

19
00:01:18,510 --> 00:01:24,210
for that digital cuz lambda only sends the content of the event without detail about the response.

20
00:01:25,140 --> 00:01:31,110
So we set that we can configure destinations for asynchronous invocation on lambda function in order

21
00:01:31,110 --> 00:01:34,830
to send the records of asynchronous invocation to another services.

22
00:01:34,860 --> 00:01:38,490
We can add a destination to our lambda function.

23
00:01:38,970 --> 00:01:44,100
That means we can configure separate destinations for event that fail processing or the events that

24
00:01:44,100 --> 00:01:47,310
are successful process it like error handling settings.

25
00:01:47,310 --> 00:01:51,570
We can configure destinations on a function, on a version or an alias.

26
00:01:52,400 --> 00:01:58,010
So you can see the image on the slide that shows a function that is processing asynchronous invocations

27
00:01:58,100 --> 00:02:03,260
when the function returns a success response or exit without throwing any error.

28
00:02:03,290 --> 00:02:06,560
Lambda sends a record of the invocation to an event.

29
00:02:06,890 --> 00:02:07,720
Event plus.

30
00:02:08,690 --> 00:02:14,990
So when an error fails all processing atom's lambda sends an invocation record to Amazon q.

31
00:02:15,230 --> 00:02:16,820
You can see the image in here.

32
00:02:16,940 --> 00:02:19,490
We are processing the asynchronous invocation.

33
00:02:19,490 --> 00:02:23,370
So that's why there's the event queue, which is the internal event of lambda function.

34
00:02:23,390 --> 00:02:29,720
When the invocation successfully finished, it can be redirect or destination to the successful event

35
00:02:29,720 --> 00:02:31,160
to the Amazon event page.

36
00:02:31,160 --> 00:02:37,220
But if the invocation got exception in two times, so that means the invocation record is processing

37
00:02:37,220 --> 00:02:42,950
the own fail process, which is the Amazon queue in the failure event destinations.

38
00:02:44,360 --> 00:02:49,760
In order to send events to the destination lambda function needs to additional permissions.

39
00:02:50,150 --> 00:02:54,590
We should add the policy with the required permission to our lambda function execution rules.

40
00:02:54,770 --> 00:02:57,680
Each destination service requires a different permissions.

41
00:02:57,680 --> 00:03:05,870
You can see that, for example, Amazon is required to send message permission SNS required to publish

42
00:03:05,870 --> 00:03:12,110
lambda, required to invoke function event which required the events, put event policy and permissions

43
00:03:12,110 --> 00:03:16,490
should be included or in execution role on the lambda function.

44
00:03:16,790 --> 00:03:21,110
As you can see that we have launched a lambda asynchronous invocation and the lambda destination.
