When is my EventBridge cron expression going to run next?
Within AWS, you can use EventBridge rules to run something on a schedule. For example, if you wanted to create daily reports, you could use an EventBridge rule to run a Lambda function that creates the report once a day.
There are two ways to specify an EventBridge rule: a cron expression or a rate expression. You use cron expressions when you want fine-grained control over the schedule, but I find them tricky to reason about. I’m not always sure if I’ve got a cron expression right, or when it’s next going to run.
Today I stumbled upon a useful feature in the EventBridge console – it’ll tell you the next time your cron expression is going to run!
Suppose you’re looking at a rule in the console:
If you click “Edit”, and scroll down to the section titled “Define pattern”, it’ll show you the next 10 trigger dates when your cron expression will run:
As you edit your cron expression, the list updates to reflect your changes. You can also choose whether the list shows times in GMT (UTC+0) or your local timezone.
I’d configured my rule in Terraform, so I hadn’t looked at the console at all – it was pure chance that I found this page. It helped me debug an issue I was having, and much faster than if I’d used trial-and-error. (I had an off-by-one bug, because I’d forgotten the UK isn’t in GMT right now.)
I don’t write many EventBridge rules so I don’t know when I’ll need this again, but it seems like something I’ll want to remember.