Amazon EventBridge

Amazon Eventbridge is a serverless event bus service that makes it easy to connect your applications with data from a variety of sources. EventBridge delivers a stream of real-time data from your own applications, software-as-a-service (SaaS) applications, and AWS services and routes that data to targets such as AWS Lambda. You can set up routing rules to determine where to send your data to build application architectures that react in real time to all of your data sources. EventBridge enables you to build event-driven architectures that are loosely coupled and distributed.

Prerequisite Tasks

To use these operators, you must do a few things:

Operators

Send events to Amazon EventBridge

To send custom events to Amazon EventBridge, use EventBridgePutEventsOperator.

tests/system/providers/amazon/aws/example_eventbridge.py[source]

put_events = EventBridgePutEventsOperator(task_id="put_events_task", entries=ENTRIES)

Create or update a rule on Amazon EventBridge

To create or update a rule on EventBridge, use EventBridgePutRuleOperator.

tests/system/providers/amazon/aws/example_eventbridge.py[source]

put_rule = EventBridgePutRuleOperator(
    task_id="put_rule_task",
    name="example_rule",
    event_pattern='{"source": ["example.myapp"]}',
    description="This rule matches events from example.myapp.",
    state="DISABLED",
)

Enable a rule on Amazon EventBridge

To enable an existing rule on EventBridge, use EventBridgeEnableRuleOperator.

tests/system/providers/amazon/aws/example_eventbridge.py[source]

enable_rule = EventBridgeEnableRuleOperator(task_id="enable_rule_task", name="example_rule")

Disable a rule on Amazon EventBridge

To disable an existing rule on EventBridge, use EventBridgeDisableRuleOperator.

tests/system/providers/amazon/aws/example_eventbridge.py[source]

disable_rule = EventBridgeDisableRuleOperator(
    task_id="disable_rule_task",
    name="example_rule",
)

Was this entry helpful?