An event rule is used to monitor a specific type of events. If an event that matches an event rule occurs, the event is routed to an event target that is associated with the event rule. An event rule can be associated with one or more event targets. You can manage event rules in the EventBridge console. This topic describes how to create, view, and delete event rules.
Prerequisites
EventBridge is activated and the required permissions are granted to a Resource Access Management (RAM) user. For more information, see Activate EventBridge and grant permissions to a RAM user.
Create an event rule
- Log on to the EventBridge console.
- In the left-side navigation pane, click Event Buses.
- In the top navigation bar, select a region.
- On the Event Buses page, click the name of the target event bus.
In the left-side navigation pane, click Event Rules.
In the left-side navigation pane, click Event Rules. On the page that appears, click Create Rule.
In the Create Rule wizard, perform the following steps:
In the Configure Basic Info step, enter a rule name in the Name field and a rule description in the Description field. Then, click Next Step.
In the Configure Event Pattern step, configure the parameters and click Next Step.
Select Alibaba Cloud Service Event Sources for the Event Source Type parameter.
Select an Alibaba Cloud service from the Event Source drop-down list and an event type from the Event Type drop-down list.
NoteEvents from Alibaba Cloud services cannot be published to custom event buses. Therefore, you cannot set the Event Source Type parameter to Alibaba Cloud Service Event Source if the event bus that you use is a custom event bus.
Select Custom Event Source for the Event Source Type parameter.
Select a custom event source from the Event Source drop-down list and specify an event pattern in the Pattern Content code editor.
For more information, see Event patterns.
In the Configure Targets step, configure event targets and click Create.
ImportantYou can configure up to five event targets for an event rule.
The event targets that you want to configure for an event rule must reside in the same region as the event rule.
EventBridge supports the following event targets:
Function Compute: computes and processes events.
For more information, see What is Function Compute?
ApsaraMQ for RocketMQ: stores and forwards events.
For more information, see What is ApsaraMQ for RocketMQ?
ApsaraMQ for RabbitMQ: stores and forwards events.
For more information, see What is ApsaraMQ for RabbitMQ?
Simple Message Queue (formerly MNS) (SMQ): stores events.
For more information, see What is SMQ.
EventBridge: filters and transforms events.
For more information, see What is EventBridge?
HTTP gateway: processes the business data of events.
HTTPS gateway: processes the business data of events.
Direct Mail: pushes events by using emails.
For more information, see What is Direct Mail?
DingTalk: notifies you of events by using DingTalk messages.
ApsaraDB RDS for MySQL: stores and forwards events.
For more information, see What is ApsaraDB RDS for MySQL?
Self-managed MySQL database: stores and forwards events.
You can select an event transformation method based on your business requirements. For more information, see Event transformation.
View the details of an event rule
On the Event Rules page, find the rule whose details you want to view and click Details in the Operations column.
On the Rule Detail page, you can view the basic information, event pattern, and event targets of the event rule.
Disable an event rule
On the Event Rules page, find the rule that you want to disable and choose in the Operations column.
In the Note message, click OK.
In the Verify Account Security dialog box, click Obtain Verification Code, enter the verification code in the Verification Code field, and then click OK.
WarningAfter you disable an event rule, specific services may be unavailable.
Enable an event rule
On the Event Rules page, find the rule that you want to enable and choose in the Operations column.
In the Note message, click OK.
Modify event targets
On the Event Rules page, find the rule for which you want to modify the event targets and click Edit Targets in the Operations column.
On the Edit Rule page, modify the configurations of the event targets and click OK.
Modify an event pattern
On the Event Rules page, find the rule for which you want to modify the event pattern and click Edit Pattern in the Operations column.
On the Edit Rule page, modify the Event Source and Pattern Content parameters and click OK.
Delete an event rule
On the Event Rules page, find the rule that you want to delete and choose in the Operations column.
In the Note message, click OK.
In the Verify Account Security dialog box, click Obtain Verification Code, enter the verification code in the Verification Code field, and then click OK.
WarningAfter you delete an event rule, the data in the event rule cannot be restored.