In this video, we are going to develop put event rule on Amazon event using a SDK libraries.
So we are in the second step, we are going to put event rule in the Amazon event page for that purpose.
Let me start with the documentation.
If you open the documentation about to put rule command, we are going to putting rule, which is the
event rule.
So if you scroll down, you can see the details and also example usage.
This time we will use put rule command and this command has inputs.
If you go to the inputs, you can see that there is several inputs that required when we are creating
a rule on the event page and this is the output of the output command rule which including the rule,
Aaron.
So please open the our visual code and we will follow several steps.
First of all, if you open the output rule that is I have implement this code and explain one by one.
You can see that we are following the same steps, which is the basically import required command and
the event page client object and after that prepare parameters.
And after that we are passing these command and parameters into the run method.
So locate the parameters please.
In the parameters we need to name, role and schedule, expiration and the state.
So this time we are creating a rule for the scheduled way.
So that's why we have set the schedule expression and the state in here.
But the important part is the rule, Aaron.
When we specify any rule definition, we have to give the role which including the required permissions
for that purpose.
I have created I have used an existing role.
Please open the IAM see that I have used an existing execution role for one of the lambda function and
after that we have to provide to some trust relationship.
You can come to permissions and open the trust relationship.
One of the roles in the IAM for the execution role.
The important thing is it is required from the service comes from the event start Amazon a s dot com
because before that I have only service comes from the lambda.
So I have expand this service principle which accommodate the events from the events that Amazon a s
come.
So please pick one of the IAM role and open the role.
Go to trust relationship and edit the service adding the event that amazon dot com.
Okay.
So after that, if you come back to our code, we have provided Aaron with copy and paste from the here
I am and provide in here.
And after that we will ready for the creating rule in our default event.
Plus on the event page.
For that purpose, please expand the terminal and run the node command.
We placing the put.
Rule that DJs hit enter.
So as you can see that we got success response and here you can see the rule Aaron that is create successfully.
To verify that please open the console go to event go to rules.
If you click the refresh button, you can see that our test event created successfully and here you
can see the event schedule and other complications is come successfully.