Events in CloudWatch
-
AWS has a new service for events which is called as Event Bridge
-
Cloudwatch events are designed to be able to respond to changes in different AWS resources and services
-
Using some rules that determine specific change or action or activity that tookplace, Cloudwatch events can be configured to respond accordingly.
-
Amazon EventBridge
- This is newer version of Amazon CloudWatch Events.
- Event Bridge is a serverless event bus service that is designed to responds to events by triggering other events
- Event bridge is very similar to Cloud Watch Events => it recieves events and responds to events from other services
- Event bridge is different from Cloud Watch Events as it can respind to the events from sources others than AWS Services.
- Events from Software as a Services or custom applications can be tied to EventBridge and we can respond Accordingly.
-
Components of Cloudwatch Event:
- Input Trigger:
- This is what starts the process or the CloudWatch Event
- It contains information that is useful for the behavior of the resulting trigger and how the event pattern behaves
- The input trigger or event source can range from different AWS Services
- In the Case of Event Bridge, in addition to AWS sources we can also get events from third party
- PagerDuty
- Opsgenie
- Datadog
- SugarCRM
- Rule/event pattern:
- The event pattern gives Cloudwatch Events all the information it needs to react to it
- Target:
- This is the destination service that reacts to the input trigger
- Input Trigger:
-
Activity: Lets try to use the events to notify the state changes (running -> shutdown etc…)
- create a rule
- Add a target
- To configure specific instances
- create a rule
-
Activity: Lets assume your organization wants to start some ec2 instances at 10:00 AM on every working day and shutdown ec2 instances at 7:00 PM to save costs
- This is where the Schedule will be your input trigger
- Lets try to create cron sytnax Refer Here
- To know more about cloudwatch schedule expression Refer Here
- The timezone over here is UTC => Convert to your timezone