AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

Rule

Defines an EventBridge Rule in this stack.

Import

import { Rule } from 'aws-cdk-lib/aws-events';

Or use the module namespace:

import * as events from 'aws-cdk-lib/aws-events';
// events.Rule

Properties

Configuration passed to the constructor as RuleProps.

enabledOptional
boolean

Indicates whether the rule is enabled.

Default: true

eventBusOptional
IEventBusRef

The event bus to associate with this rule.

Default: - The default event bus.

roleOptional
IRoleRef

The role that is used for target invocation. Must be assumable by principal `events.amazonaws.com`.

Default: - No role associated

scheduleOptional
Schedule

The schedule or rate (frequency) that determines when EventBridge runs the rule. You must specify this property, the `eventPattern` property, or both. For more information, see Schedule Expression Syntax for Rules in the Amazon EventBridge User Guide.

Default: - None.

targetsOptional
IRuleTarget[]

Targets to invoke when this rule matches an event. Input will be the full matched event. If you wish to specify custom target input, use `addTarget(target[, inputOptions])`.

Default: - No targets.

4 properties inherited from EventCommonOptions
crossStackScopeOptionalinherited from EventCommonOptions
Construct

The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region). This helps dealing with cycles that often arise in these situations.

Default: - none (the main scope will be used, even for cross-stack Events)

descriptionOptionalinherited from EventCommonOptions
string

A description of the rule's purpose.

Default: - No description

eventPatternOptionalinherited from EventCommonOptions
EventPattern

Additional restrictions for the event to route to the specified target. The method that generates the rule probably imposes some type of event filtering. The filtering implied by what you pass here is added on top of that filtering.

Default: - No additional filtering based on an event pattern.

ruleNameOptionalinherited from EventCommonOptions
string

A name for the rule.

Default: AWS CloudFormation generates a unique physical ID.

Get the Amazon EventBridge Cheat Sheet

Everything you need to know about Amazon EventBridge on one page. HD quality, print-friendly.

Download Free Infographic