Testing event patterns using the EventBridge Sandbox
Defining an event pattern is typically part of the larger process of creating a new rule or editing an existing one. Using the Sandbox in EventBridge, however, you can quickly define an event pattern and use a sample event to confirm the pattern matches the desired events, without having to create or edit a rule. Once you've got your event pattern tested, EventBridge give you the option of creating a new rule using that event pattern directly from the sandbox.
For more information about event patterns, see Amazon EventBridge event patterns.
Important
In EventBridge, it is possible to create rules that can lead to higher-than-expected charges and throttling. For example, you can inadvertently create a rule that leads to an infinite loop, where a rule is fired recursively without end. Suppose you created a rule to detect that ACLs have changed on an Amazon S3 bucket, and trigger software to change them to the desired state. If the rule is not written carefully, the subsequent change to the ACLs fires the rule again, creating an infinite loop.
For guidance on how to write precise rules and event patterns to minimize such unexpected results, see Best practices for rules and Best practices.
To test an event pattern using the EventBridge sandbox
Open the Amazon EventBridge console at https://console.aws.amazon.com/events/
. -
In the navigation pane, choose Developer resources, then select Sandbox, and on the Sandbox page choose the Event pattern tab.
-
For Event source, choose AWS events or EventBridge partner events.
-
In the Sample events section, choose a Sample event type against which you want to test your event pattern.
The following sample event types are available:
-
AWS events – Select from events emitted from supported AWS services.
-
EventBridge partner events – Select from events emitted from third-party services that support EventBridge, such as Salesforce.
-
Enter my own – Enter your own event in JSON text.
You can also use an AWS or partner event as the starting point for creating your own custom event.
Select AWS events or EventBridge partner events.
Use the Sample events dropdown to select the event you want to use as a starting point for your custom event.
EventBridge displays the sample event.
Select Copy.
Select Enter my own for Event type.
Delete the sample event structure in the JSON editing pane, and paste the AWS or partner event in its place.
Edit the event JSON to create your own sample event.
-
-
Choose a Creation method. You can create an event pattern from an EventBridge schema or template, or you can create a custom event pattern.
-
(Optional) To create a rule with this event pattern, and assign the rule to a specific event bus, choose Create rule with pattern.
EventBridge takes you to Step 1 of Create rule, which you can use to create a rule and assign it to the event bus of your choice.
Note that Step 2 - Build event pattern contains the event pattern information you've already specified, and which you can accept or update.
For more on how to create rules, see Creating rules that react to events in Amazon EventBridge.