Configuring EventBridge and Event Patterns
Last updated
Last updated
The EventBridge Management Console can be used to view and manage EventBridge buses, rules, global endpoints, and more.
Each region has a default bus to which AWS services send events, but you can also create your own custom buses to receive events from buses in other accounts and regions, or to receive events from an external source, such as AWS Partners like ZenDesk or Shopify.
You can view and create buses from the Buses section of the console. From the Actions dropdown, you can send test events to a bus, configure archives (caching of events published to a bus for a defined retention period), and initiate schema discovery, which captures the schemas of different events that are streamed through your bus.
Events are JSON objects detailing a change in your operational environment. An example event may look like this, condensed here for readability:
This event shows a console user attempting to delete a key pair in EC2. EventBridge can capture events from user API calls (captured via CloudTrail), service notifications (e.g., a state-change notification for EC2 instances), external AWS Partners like ZenDesk or Shopify, and events forwarded from buses in other regions and accounts.
This enables event-driven automation and allows you to easily monitor changes in your account and stream events from third-party sources. It's worth noting that AWS services only send events to the default bus.
The Rules section of the EventBridge management console can be used to view, create, and manage event rules. You must select which bus's rules you wish to view or configure. From here, you can create, edit, disable and delete rules. Disabling a rule simply stops the bus from comparing events against it and sending matches to the rule’s target. You can re-enable any disabled rules, whereas deleting a rule is irreversible.
Rules can be either triggered by events (when an event matches a pre-defined pattern), or on a schedule. Clicking on a rule’s name from here shows you more details about the rule and provides the options to edit the schedule or event pattern, view and configure targets, and disable or delete the rule.
For rules triggered by events, you must build an event pattern. You do this as part of creating the rule itself. First, you need to choose the source. This will usually be an AWS event source.
Following this, you have to define the pattern to match events:
Pick your source – in this series, this will usually be AWS events or EventBridge partner events.
You can then define your event pattern. Fortunately, an event pattern builder is included, where you can choose the event source, the service (if applicable), and the event type. You can even choose to only capture events with a certain name, using the Specific options field!
An alternative to triggering rules based on events is to run rules on a schedule. Instead of building an event pattern, you simply define either the times and dates at which you want the rule to trigger (e.g., every Friday at 7 pm), using cron expressions, or you define the rate at which you wish the rule to trigger (e.g., every 3 hours). You can do this via the Eventbridge Scheduler, which can be found under the Scheduler → Schedules section of the Eventbridge console.
Amazon EventBridge Scheduler is a serverless scheduler that allows you to create, run, and manage tasks from one centrally managed service. It supports templated and universal targets that can invoke any AWS service and allows flexible time windows and retries for reliable event delivery. To create a schedule, click create a schedule. You will be presented with a series of forms to specify your schedule pattern (a one-time run or a recurring task), target API, retry policies, encryption, and execution permissions.