Here you are.
And welcome back.
Now, in today's video, we will be discussing about the Amazon event bridge.
Now, in case if you have made use of the Cloud watch events, event bridge is very similar to that,
you can consider it as a more enhanced version to the cloud watch events.
Now, it basically makes use of the same set of underlying APIs and in the future the cloud events name
would typically get replaced with the event bridge.
So this is the newer one.
So let's go ahead and look into it in more detail.
Now, at a high level overview event, Bridge basically delivers a stream of real time data from an
event source to a specific target.
Now, the overall architecture involves three primary components.
The first one is the event source on the left.
The second one is the target on the right hand side.
And then you have the event bridge where the rules are created.
So the basic idea is whenever an event is created, event can be anything.
It can be an easy to instance that is getting terminated or a three bucket that is getting created or
any user that has created a support ticket.
Anything can be an event.
So whenever an event happens, what you want, you want a specific target to be triggered.
For example, let's say whenever a support ticket got created in your custom application, then it should
trigger the SNS topic.
The SNS topic in turn will go ahead and send an email as well as SMS.
So that is something that can be achieved with the help of event bridge.
Now there can be multiple use cases that can be achieved, but this is the primary idea where the event
source generates an event.
Depending upon the role that you create in the event bridge that will trigger a specific target, it
can be lambda sense cloud, watch, etc. and then your application can work accordingly.
So let's do one thing.
Let's take some use cases that will allow us to understand things in more detail.
Now, the first use case is associated with the EC two two sense.
So what this means, EC two is basically the event source and since on the right hand side is basically
the target and in the middle you have event bridge.
So what you want, whenever a certain action happens, let's say whenever you see two instances stop
or whenever you see two instances terminated, then the administrator should be notified.
So what happens here, whenever you see two instances stop, terminate.
So whenever you create an event bridge rule, you specify the exact event that you want to monitor.
So within here you have an event of EC to stop and EC to terminate.
And once this event occurs, then the event bridge will go ahead and trigger the target.
In this case, the target is SNS topic and this target has an email based notification so the administrator
would be notified over email.
Now the second use case is associated with stopping of the dev EC two instances.
In fact, this is something that we used to implement based on the cloud watch event service.
So what we used to do is that we used to stop all the development instances at 8 p.m. on Fridays.
Hopefully all the developers have gone home by then and we used to start all the EC two instances at
9 a.m. on Mondays in the dev environment.
Now how this architecture looked first we used to have an event bridge, now even bridge along with
a specific event source that we were discussing.
Now one of the sources can be a schedule.
So schedule like 8 p.m. on Friday, even bridge gets triggered and what it will do, it will go ahead
and run a lambda function.
College Topic two And this lambda function in turn will go ahead and stop all the EC two instances.
Similarly, you have a schedule on 9 a.m. on Monday.
On this specific schedule event bridge gets triggered.
It will go ahead and run the start EC two base lambda function on Mondays and all the EC two instances
would get started.
So these are the two use cases based on event bridge.
Again, a lot of flexibility on what you can do.
So let's go ahead and try it out practically.
So for today's practical what we will be doing on the event source, we will have three and on the target
we will have cloud watch logs.
So what should happen is any time a S3 bucket has a put object operation or a delete object operation,
automatically the data should be sent to the cloud watch log group.
And this is something that we will be doing with the event Bridge.
Now, one of the first thing that we need is we have to make sure that the target is available.
So let's quickly go to our S3 console.
Let's look if we have any buckets available.
All right.
So we have multiple S3 buckets that are available.
This is fine.
So we will be using this for our test purposes.
And the next thing that we need to do is we have to enable.
Cloud trail.
So for our event, Bridge to know that a specific operation has happened at a three level, you need
to have cloud three.
So let's go ahead and quickly enable cloud rail in the region of Singapore.
So within trails currently.
Let's quickly create a new trail.
Let's call it as a demo trail will not enable the games right now.
Let's do it next.
Now, do note that specifically for three related operations, you have to enable the data events here.
And within the data events, you have the data event source of three.
Since we want to monitor the S3 three put object and delete object operation.
And here, let's go ahead and do a next.
And let's create a drill.
Perfect.
So now we can go ahead and quickly go to Event Bridge.
So let's do an event bridge here.
Now, within the event bridge, if we quickly go to rules, we can go ahead and quickly create a new
rule over here.
Let's call it as demo rule.
And within the defined pattern type we were discussing that you can either define by event pattern in
the use case one and in the use case two, we were discussing about schedule on how the event bridge
rule can run on Friday at 8 p.m. and on Monday at 9 a.m..
So if you'll see when you click on schedule, you can either specify a fixed rate in terms of hours,
minutes as well as this, or you can create a cron expression here.
However, for today's video we will be working based on an event pattern and within here we will be
selecting a predefined event by service.
The service that we are interested is the eight of us.
You can also have a different service partners.
I'll be selecting the service name.
Let's specify three and the event type.
We are looking for an object level operation and which is the object level operation that we are looking
for.
Let's specify it.
So first is the put object.
Then you have the delete object related operation.
Let's select both of them and as soon as you select it on the right hand side, the event pattern would
automatically get created for you.
So this is great.
And if you go a bit down, the next important part is the target.
So when this specific event occurs, when someone uploads the object to S3 bucket or when someone deletes
the object in the bucket, what should be triggered.
So the triggering point, again, there are a lot of options that are available here.
We are more interested in today's video.
Let's see Cloud Watch log group and within the log group let's call it as as three events.
Once then you can go ahead and do a create.
Perfect.
So our event rule is created now in order to verify.
Let's quickly go to the cloud watch service here and within the log groups.
You should see that event.
Bridge should have created one log group here.
And yes, you have one log group as three events that is automatically created.
Great.
So now time to test things out.
So I have one bucket in the Singapore region here.
Let's go ahead and upload some data.
I'll add a file so I have some sample files.
Let's go ahead and add one among them and I'll do an upload grid.
Now, within our Cloud workflow group, let's open up the log group here and automatically you should
see there is one log stream that got created.
And this log stream basically contains the information here.
Let's go a bit down and see what it contains.
So within here, you see it is basically giving you the exact year in which is zero one.
And it is also showing you the three bucket where this specific file was uploaded, which is my lapse
temp access logs.
So this is what the event bridge does at a high level overview.
So just to realize one of the great things about even bridges that not only you can go ahead and create
rules based on services, but it also supports custom applications, the SAS applications and various
others as an event source and depending upon the rule that you create, a specific target can also be
notified.
So with this will conclude today's video.