1
00:00:00,390 --> 00:00:06,420
In this video, we are going to talk about using a lambda with other sources.

2
00:00:06,570 --> 00:00:13,980
And specifically, we will look for the how a lambda works with the Amazon event, which is not that

3
00:00:13,980 --> 00:00:21,030
we will develop almost an event list with Lambda Basket microservices, basically basket microservices,

4
00:00:21,030 --> 00:00:27,900
publish an event in a synchronous way and this will consume by ordering queue with using the event pass

5
00:00:27,900 --> 00:00:29,160
as an event bridge.

6
00:00:29,880 --> 00:00:33,690
So our basket microservices will communicate with Amazon event minutes.

7
00:00:33,690 --> 00:00:39,660
So that's why we should understand how a lambda can be worked with the Amazon event village.

8
00:00:39,900 --> 00:00:43,260
So let's examine a documentation about this topic.

9
00:00:43,260 --> 00:00:44,880
But before that, let's see.

10
00:00:44,880 --> 00:00:50,460
Our big feature is you can see that we have finished the synchronous invocation and now we will focus

11
00:00:50,460 --> 00:00:56,310
on the asynchronous invocation, which is basically a basket microservices, which is the lambda function.

12
00:00:56,310 --> 00:01:02,930
We'll publish basket checkout event to the Amazon event page in order to decouple basket and ordering

13
00:01:02,940 --> 00:01:07,410
microservices and perform asynchronous communication between basket and ordering.

14
00:01:07,410 --> 00:01:14,280
Because once basket lambda function publish checkout event to the Amazon event page, this will be consumed

15
00:01:14,280 --> 00:01:17,670
from the ordering microservices over the A base case.

16
00:01:18,060 --> 00:01:21,720
Okay, let's focus on this asynchronous invocation.

17
00:01:21,780 --> 00:01:28,260
And in this section we will develop and see how we can interact basket lambda microservices with the

18
00:01:28,260 --> 00:01:31,650
Amazon event, which we publish in checkout event.

19
00:01:32,070 --> 00:01:35,460
So let's examine the documentation about this topic.

20
00:01:35,580 --> 00:01:42,060
If you go to this documentation, a dubious lambda developer, go ahead and come here.

21
00:01:42,060 --> 00:01:50,010
Working with other services, we can see how a Lambda work, different services, very detailed explanation.

22
00:01:51,280 --> 00:01:55,080
Basically a lambda integrates with other sources.

23
00:01:55,150 --> 00:01:58,450
In order to invoke functions or take other actions.

24
00:01:58,480 --> 00:02:05,730
In our case, we expect to publish anyone to the Amazon event page, and there are some common use cases.

25
00:02:05,740 --> 00:02:12,010
If you scroll down, you can see these common use cases in here, but also if you scroll, then you

26
00:02:12,010 --> 00:02:14,750
can see the list of services.

27
00:02:14,770 --> 00:02:22,690
This is the listing, listing of services and you can see how services can be communicate or interact

28
00:02:22,690 --> 00:02:24,880
with a lambda in here.

29
00:02:24,910 --> 00:02:32,680
There are lots of services that we can interact with the lambda functions and if you scroll down you

30
00:02:32,680 --> 00:02:35,170
can see event driven in locations.

31
00:02:35,410 --> 00:02:40,270
Basically, our bus checkout event is event driven invocation.

32
00:02:40,390 --> 00:02:45,900
You can see in this picture we can send this event to the Amazon event page.

33
00:02:45,910 --> 00:02:52,180
And this is the event driven invocation from basket Lambda Micro Services to Amazon event page.

34
00:02:52,330 --> 00:02:58,480
And it basically publishes an event and this is invoked ordering lambda asynchronously.

35
00:02:58,540 --> 00:03:02,110
So we will communicate the event with this way.

36
00:03:02,110 --> 00:03:08,440
But it comes to the sent to the Amazon event page and this will be consumed by the organic microservices.

37
00:03:08,680 --> 00:03:17,080
Now we will develop the this publish message but also lambda can be pulling this event.

38
00:03:17,080 --> 00:03:19,600
We choosing the lambda pulling in location type.

39
00:03:19,720 --> 00:03:25,840
If you come back to our documentation, if you scroll down, you can see the another communication type,

40
00:03:25,840 --> 00:03:27,640
which is the lambda polling.

41
00:03:27,670 --> 00:03:34,230
We will see in the next section how Lambda can be pulling events or message from the Amazon space.

42
00:03:35,260 --> 00:03:35,860
Okay.

43
00:03:36,430 --> 00:03:43,570
And if you come here and see the event source mapping, right click open meetup, you can see the Lambda

44
00:03:43,570 --> 00:03:46,480
event source mapping communication with different sources.

45
00:03:46,830 --> 00:03:50,400
You see that Dynamo DB kinesis, aqueous and so on.

46
00:03:50,410 --> 00:03:57,520
These are the stream based and batch based services that lambda pull from the event source mapping communication.

47
00:03:57,520 --> 00:04:00,340
We will see these in the next section.

48
00:04:00,340 --> 00:04:05,140
So in this video, I'm going to focus on the event driven invocations.

49
00:04:05,140 --> 00:04:09,040
So this is important because we will use event driven invocation.

50
00:04:09,040 --> 00:04:14,050
We're using the Amazon event page if you scroll up and see that.

51
00:04:15,090 --> 00:04:18,450
These are the services that communicate with the ADA lambda.

52
00:04:18,480 --> 00:04:22,850
So in here I'm going to find Amazon event, which you can see in here.

53
00:04:22,860 --> 00:04:27,360
And also method of invocation is event and asynchronous invocation.

54
00:04:27,480 --> 00:04:34,320
We will use publisher scribe pattern for implementing event driven asynchronous invocation with a lambda

55
00:04:34,320 --> 00:04:37,290
and advantage for basket microservices.

56
00:04:37,290 --> 00:04:41,110
And the event was so right click open liftoff.

57
00:04:41,310 --> 00:04:47,700
This is what we are going to be looking for using a lambda with Amazon event advantage.

58
00:04:48,030 --> 00:04:50,700
I want also called cloud watch events.

59
00:04:50,700 --> 00:04:54,480
This is the legacy name and please don't be confused about that.

60
00:04:54,480 --> 00:05:01,740
We will focus on the Amazon event page using with a lambda so event which basically helps you to respond

61
00:05:01,740 --> 00:05:04,470
to state chains in our resources.

62
00:05:04,560 --> 00:05:10,020
When our resources change state, they automatically send events into event stream.

63
00:05:11,050 --> 00:05:16,960
So we tailored which we can create rules that match selected events in the stream and draw them to the

64
00:05:16,990 --> 00:05:20,560
our target aid, which is lambda functions and so on.

65
00:05:20,710 --> 00:05:27,520
So it invokes our function asynchronously with an event document that grabs the event from the source.

66
00:05:27,640 --> 00:05:32,430
So if you scroll down, you can see the example event bridge events.

67
00:05:32,440 --> 00:05:39,400
So the following example you can see in here basically shows that this is an event and that originated

68
00:05:39,400 --> 00:05:43,360
from a database snapshot in Amazon relational database sources.

69
00:05:43,570 --> 00:05:49,210
So this is an example event which is related with the Amazon relational database.

70
00:05:49,210 --> 00:05:56,500
So you can see that the event needs to be this kind of information, virgin ID, detail type, source

71
00:05:56,530 --> 00:05:57,570
account and so on.

72
00:05:57,580 --> 00:06:06,220
We will see all these attributes from the previous video, but you should see the exactly the same format

73
00:06:06,220 --> 00:06:12,640
in here as you can see that the important part is the ID in order to track these events with different

74
00:06:12,640 --> 00:06:19,210
database resources and then other important attributes are detail type and the source, because detail

75
00:06:19,210 --> 00:06:27,940
type and source indicate that which sources trigger this event and which action will be performed,

76
00:06:27,940 --> 00:06:32,680
which event will be performed when this event published and raw to target system.

77
00:06:33,010 --> 00:06:40,060
And also another important attribute is detail because once the event is published, detail attribute

78
00:06:40,060 --> 00:06:42,190
is including the event itself.

79
00:06:42,190 --> 00:06:44,860
So that means event data will be stored in here.

80
00:06:44,980 --> 00:06:51,160
In our case, we will store basket out the data which including the basket and basket items in this

81
00:06:51,160 --> 00:06:56,040
detail as a JSON format in order to move these data to ordering microservices.

82
00:06:56,050 --> 00:07:03,070
So these are the important an example JSON object which triggered to Amazon event which when publishing

83
00:07:03,070 --> 00:07:05,920
an event, this is the structure of the JSON.

84
00:07:07,540 --> 00:07:16,090
So we will develop our basket microservices according to these events object because when we are developing

85
00:07:16,090 --> 00:07:21,790
our basket microservices, basket microservices basically publish an event as a basket checkout event

86
00:07:21,790 --> 00:07:28,030
and it should publish a message with this format which including the detail type, detail type, source

87
00:07:28,030 --> 00:07:29,440
and detail and so on.

88
00:07:29,590 --> 00:07:37,000
So as you can see that we have also understand how a lambda function typical to Amazon event page and

89
00:07:37,000 --> 00:07:40,000
examine example event JSON object structure.

90
00:07:40,030 --> 00:07:45,130
In the next video we are going to walk through the Amazon event, which we're choosing a management

91
00:07:45,130 --> 00:07:45,730
console.
