1
00:00:00,120 --> 00:00:07,220
In this video, we are going to develop put event rule on Amazon event using a SDK libraries.

2
00:00:07,230 --> 00:00:13,050
So we are in the second step, we are going to put event rule in the Amazon event page for that purpose.

3
00:00:13,050 --> 00:00:14,730
Let me start with the documentation.

4
00:00:14,730 --> 00:00:20,970
If you open the documentation about to put rule command, we are going to putting rule, which is the

5
00:00:20,970 --> 00:00:21,660
event rule.

6
00:00:21,660 --> 00:00:26,190
So if you scroll down, you can see the details and also example usage.

7
00:00:26,190 --> 00:00:30,660
This time we will use put rule command and this command has inputs.

8
00:00:30,660 --> 00:00:37,140
If you go to the inputs, you can see that there is several inputs that required when we are creating

9
00:00:37,140 --> 00:00:42,780
a rule on the event page and this is the output of the output command rule which including the rule,

10
00:00:42,780 --> 00:00:43,470
Aaron.

11
00:00:43,590 --> 00:00:48,750
So please open the our visual code and we will follow several steps.

12
00:00:48,750 --> 00:00:54,600
First of all, if you open the output rule that is I have implement this code and explain one by one.

13
00:00:54,690 --> 00:01:00,750
You can see that we are following the same steps, which is the basically import required command and

14
00:01:00,750 --> 00:01:04,500
the event page client object and after that prepare parameters.

15
00:01:04,500 --> 00:01:09,720
And after that we are passing these command and parameters into the run method.

16
00:01:09,720 --> 00:01:12,270
So locate the parameters please.

17
00:01:12,270 --> 00:01:17,220
In the parameters we need to name, role and schedule, expiration and the state.

18
00:01:17,220 --> 00:01:21,180
So this time we are creating a rule for the scheduled way.

19
00:01:21,180 --> 00:01:25,650
So that's why we have set the schedule expression and the state in here.

20
00:01:25,680 --> 00:01:28,560
But the important part is the rule, Aaron.

21
00:01:28,560 --> 00:01:35,400
When we specify any rule definition, we have to give the role which including the required permissions

22
00:01:35,400 --> 00:01:36,420
for that purpose.

23
00:01:36,420 --> 00:01:39,450
I have created I have used an existing role.

24
00:01:39,450 --> 00:01:45,900
Please open the IAM see that I have used an existing execution role for one of the lambda function and

25
00:01:45,900 --> 00:01:49,530
after that we have to provide to some trust relationship.

26
00:01:49,530 --> 00:01:53,430
You can come to permissions and open the trust relationship.

27
00:01:53,430 --> 00:01:56,280
One of the roles in the IAM for the execution role.

28
00:01:56,310 --> 00:02:03,690
The important thing is it is required from the service comes from the event start Amazon a s dot com

29
00:02:03,690 --> 00:02:07,230
because before that I have only service comes from the lambda.

30
00:02:07,230 --> 00:02:13,980
So I have expand this service principle which accommodate the events from the events that Amazon a s

31
00:02:14,040 --> 00:02:14,580
come.

32
00:02:14,580 --> 00:02:19,080
So please pick one of the IAM role and open the role.

33
00:02:19,110 --> 00:02:25,950
Go to trust relationship and edit the service adding the event that amazon dot com.

34
00:02:25,980 --> 00:02:26,510
Okay.

35
00:02:26,610 --> 00:02:34,500
So after that, if you come back to our code, we have provided Aaron with copy and paste from the here

36
00:02:34,530 --> 00:02:36,870
I am and provide in here.

37
00:02:36,870 --> 00:02:40,800
And after that we will ready for the creating rule in our default event.

38
00:02:40,800 --> 00:02:42,150
Plus on the event page.

39
00:02:42,150 --> 00:02:46,320
For that purpose, please expand the terminal and run the node command.

40
00:02:46,350 --> 00:02:48,510
We placing the put.

41
00:02:49,420 --> 00:02:51,790
Rule that DJs hit enter.

42
00:02:51,970 --> 00:02:58,550
So as you can see that we got success response and here you can see the rule Aaron that is create successfully.

43
00:02:58,570 --> 00:03:03,390
To verify that please open the console go to event go to rules.

44
00:03:03,400 --> 00:03:08,530
If you click the refresh button, you can see that our test event created successfully and here you

45
00:03:08,530 --> 00:03:12,640
can see the event schedule and other complications is come successfully.
