You can create rules that self-trigger on an automated schedule in EventBridge using cron or rate expressions. All scheduled events use UTC time zone and the minimum precision for schedules is 1 minute.
EventBridge supports cron expressions and rate expressions. Rate expressions are simpler to define but don’t offer the fine-grained schedule control that cron expressions support. For example, with a cron expression, you can define a rule that triggers at a specified time on a certain day of each week or month. In contrast, rate expressions trigger a rule at a regular rate, such as once every hour or once every day.
Let’s give it a try!
On the EventBridge homepage, open the left hand navigation.
Select Rules from the left-hand menu.
Click Create rule.
On the Create rule page:
OrdersReconciliationas the Name of the rule
Runs reconciliation routine on orders every minute Monday to Sundayfor Description
Select Schedule from the Define pattern panel.
Select Cron expression and enter
* * ? * mon-sun *.
This will schedule a message to be delivered every minute, Monday through Friday.
Keep AWS default event bus selected as the event bus.
You can only use a scheduled expression for the default event bus.
Configure your target to be a CloudWatch log group
Leave the Tags blank.
Choose Log groups in the left navigation and select the /aws/events/orders_reconciliation log group.
Verify that you have successfully created a rule and that the scheduled expression is successfully logging to the CloudWatch Log group you specified as a target.
After a few minutes your streams for /aws/events/orders_reconciliation should look similar to this:
The cron expression can take up to 60 seconds to trigger. If you follow the steps below and do not see your event, refresh the Log streams. If you still have troubles verifying the event, please notify the workshop staff.
Congratulations, you have just completed your first scheduled expression for an Amazon EventBridge rule. Next, spend some time exploring integrating AWS Lambda Destinations with EventBridge.