1
00:00:00,120 --> 00:00:00,900
In this video.

2
00:00:00,900 --> 00:00:06,540
We are going to continue to create a role, but this time we will create event matching pattern for

3
00:00:06,540 --> 00:00:09,900
rule in Amazon event bridge using the development console.

4
00:00:09,900 --> 00:00:12,570
So that means we are going to go to step two.

5
00:00:12,570 --> 00:00:17,970
So please select the rule type as a rule with an event pattern and click the next button.

6
00:00:17,970 --> 00:00:24,930
So see that this is the event pattern page that has some parts, which is the event source sample events.

7
00:00:24,930 --> 00:00:30,930
If you scroll down, you can see the actual event pattern that we will follow and fill this event source

8
00:00:30,930 --> 00:00:31,470
in here.

9
00:00:31,500 --> 00:00:31,660
Okay.

10
00:00:31,680 --> 00:00:36,690
First of all, we will choose and select the event source of the Amazon event bridge.

11
00:00:36,690 --> 00:00:43,260
So the default complication is adverse events or event partner events that we will also select this

12
00:00:43,290 --> 00:00:48,210
option because this will trigger event from the resources.

13
00:00:48,360 --> 00:00:50,580
So if you scroll down, you can see two parts.

14
00:00:50,580 --> 00:00:54,780
The first part is sample event and the second part is event pattern.

15
00:00:54,780 --> 00:00:59,850
So the first part, the sample event part is optional, it is not required, but I will explain how

16
00:00:59,850 --> 00:01:00,750
we can use it.

17
00:01:00,750 --> 00:01:04,950
But if you come to event pattern, we will define event pattern in here.

18
00:01:05,190 --> 00:01:12,570
If you look at the or event patterns, basically we can use a predefined pattern provided by a sources

19
00:01:12,570 --> 00:01:14,250
or we can create a custom pattern.

20
00:01:14,370 --> 00:01:19,020
If you click this button, we can see that we can create a custom patterns.

21
00:01:19,020 --> 00:01:23,910
But I would like to see predefined patterns provide from the base.

22
00:01:23,970 --> 00:01:31,260
If you click the event pattern form, you can see that there is an event source and a list services

23
00:01:31,260 --> 00:01:37,320
we have select event source is a services and you can see the list source name.

24
00:01:37,320 --> 00:01:40,020
For example, I'm searching for the S-3.

25
00:01:40,020 --> 00:01:44,850
You can say that Amazon S3, which will be the our event source.

26
00:01:44,850 --> 00:01:51,510
So after selecting the services that comes from event type, that means there is several events can

27
00:01:51,510 --> 00:01:57,630
be triggered from the Amazon S3 If you open this box, you can see that there is different notification

28
00:01:57,630 --> 00:01:58,590
or and so on.

29
00:01:58,590 --> 00:02:00,540
I'm choosing the all events.

30
00:02:00,570 --> 00:02:06,090
If you select to all events the event pattern generated from the alias that you can see that there is

31
00:02:06,090 --> 00:02:09,390
only source attribute, which is the alias that is S3.

32
00:02:09,420 --> 00:02:16,800
So that means every event happens from the A S3 will trigger our event rule into the Amazon event bridge.

33
00:02:16,920 --> 00:02:22,770
So if you scroll up this time, I would like to show you how we can see the sample events will trigger

34
00:02:22,770 --> 00:02:26,460
event which we can see the sample event generator box in here.

35
00:02:26,490 --> 00:02:31,980
If you come here, select the services and you can see the all the sample events in the dropdown.

36
00:02:32,020 --> 00:02:35,040
There is lots of event sources, sample events.

37
00:02:35,040 --> 00:02:41,070
I'm going to search for the S3 and I would like to object created event in the S3.

38
00:02:41,070 --> 00:02:47,130
If you select this section, you can see the generated predefined sample event.

39
00:02:47,400 --> 00:02:49,770
You can see the details of this event.

40
00:02:49,800 --> 00:02:56,460
If you check that event selected from the Amazon event, you can see the event, JSON version, ID ID

41
00:02:56,490 --> 00:03:00,870
detail, type, source detail and so on.

42
00:03:01,050 --> 00:03:08,940
So basically if we explain this sample event, there is a detail type is very important, which is the

43
00:03:08,940 --> 00:03:12,570
object created and the source is very important, which is the S3.

44
00:03:12,570 --> 00:03:18,840
So these events trigger outcomes when it comes to Amazon S3 Object Create Action happened.

45
00:03:18,840 --> 00:03:24,030
So if you scroll down, you can see the details under the tail section, which could name and which

46
00:03:24,030 --> 00:03:26,880
object name created on the Amazon S3.

47
00:03:27,030 --> 00:03:28,290
Okay, very good.

48
00:03:28,380 --> 00:03:31,560
Now I'm going to compare it with our event pattern.

49
00:03:31,560 --> 00:03:32,670
So think about that.

50
00:03:32,670 --> 00:03:40,320
Amazon S3 triggered this event and it comes to our event rule and our event pattern is works and it

51
00:03:40,320 --> 00:03:43,470
is basically looking to source option.

52
00:03:43,470 --> 00:03:48,510
So that means this event will trigger our rule because it makes our event pattern.

53
00:03:48,510 --> 00:03:54,240
So basically event pattern is only looking for the source attribute into incoming event JSON.

54
00:03:54,240 --> 00:04:00,090
If the source attribute exists, then compared with the Amazon S3, you can call you can see the source

55
00:04:00,090 --> 00:04:03,150
attribute and go back to incoming sample event.

56
00:04:03,180 --> 00:04:05,160
The source attributes are match.

57
00:04:05,160 --> 00:04:13,350
So if you scroll down and click the test button, you can see that sample event matched the event pattern.

58
00:04:13,350 --> 00:04:19,080
So we are simulating the incoming event from the sample event and after that we are creating our event

59
00:04:19,080 --> 00:04:21,540
pattern and we can test in this window.

60
00:04:21,570 --> 00:04:25,920
This is very powerful feature when we designing our role in the Amazon event page.

61
00:04:26,010 --> 00:04:33,930
For example, if I change this sample event to the case and if you come here and click the test button,

62
00:04:33,930 --> 00:04:40,170
you can see that sample event did not match because we are looking source as an Amazon S3, but the

63
00:04:40,170 --> 00:04:42,000
source comes with the case.

64
00:04:42,000 --> 00:04:49,200
So let me come back to S3 created and scroll down so you understand the idea how we can create event

65
00:04:49,200 --> 00:04:54,420
pattern in the Amazon event page so we can add one more criteria or event pattern.

66
00:04:54,450 --> 00:04:57,300
You can copy from the detail type in here.

67
00:04:58,530 --> 00:05:01,140
And come here and click the edit pattern.

68
00:05:01,140 --> 00:05:09,630
So if you add a new item, you should specify the brackets because this should be an array.

69
00:05:10,190 --> 00:05:16,320
And as you can see that I have added the detail type as object created and this event pattern should

70
00:05:16,320 --> 00:05:17,970
be JSON format.

71
00:05:18,090 --> 00:05:20,730
And of course, as you can see, that is the invalid syntax.

72
00:05:20,730 --> 00:05:24,300
We should remove this comma and now JSON is valid.

73
00:05:24,300 --> 00:05:30,510
So if you click the test button now you can see that sample event makes the event pattern because it

74
00:05:30,510 --> 00:05:32,670
is coming from the object created from the S3.

75
00:05:32,700 --> 00:05:39,630
If you change the object created event from the S3, let me search for example, object, delete it

76
00:05:39,660 --> 00:05:43,710
if you come here, see that the tail type is changed if you scroll down.

77
00:05:43,710 --> 00:05:50,070
Now, if I test pattern, you can see that this event is not matched because this time detail type is

78
00:05:50,070 --> 00:05:50,970
not object created.

79
00:05:50,970 --> 00:05:52,470
It is an object related.

80
00:05:52,620 --> 00:05:58,230
You understand the idea how we can create event pattern into our application.

81
00:05:58,230 --> 00:06:06,000
Now I'm going to choose a little bit basic event button, which is the Amazon S3 all events and I'm

82
00:06:06,000 --> 00:06:09,660
going to click the next button and see what's happened.

83
00:06:09,660 --> 00:06:15,600
Make sure that you have selected a service S3 and all events and click the next button.

84
00:06:16,020 --> 00:06:19,890
Okay, now it is time to select targets.

85
00:06:20,010 --> 00:06:25,770
So in the Select Target, we are select target to invoke one an event match to our event pattern or

86
00:06:25,770 --> 00:06:27,240
one schedule is triggered.

87
00:06:27,270 --> 00:06:29,520
In the next video we are going to select the target.
