Skip to content
v2.274.0

RuleProps Struct ​

Properties for defining an EventBridge Rule.

Example ​

ts
import * as redshiftserverless from 'aws-cdk-lib/aws-redshiftserverless'

declare const workgroup: redshiftserverless.CfnWorkgroup;

const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.rate(cdk.Duration.hours(1)),
});

const dlq = new sqs.Queue(this, 'DeadLetterQueue');

rule.addTarget(new targets.RedshiftQuery(workgroup.attrWorkgroupWorkgroupArn, {
  database: 'dev',
  deadLetterQueue: dlq,
  sql: ['SELECT * FROM foo','SELECT * FROM baz'],
}));

Properties ​

crossStackScopeConstructcross_stack_scopeConstructcrossStackScopeConstructCrossStackScopeConstructCrossStackScopeConstruct= none (the main scope will be use…#
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

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

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string= No description#
A description of the rule's purpose.
enabledbooleanenabledboolenabledBooleanEnabledboolEnabled*bool= true#
Indicates whether the rule is enabled.
eventBusIEventBusRefevent_busIEventBusRefeventBusIEventBusRefEventBusIEventBusRefEventBusIEventBusRef= The default event bus.#
The event bus to associate with this rule.
eventPatternEventPatternevent_patternEventPatterneventPatternEventPatternEventPatternEventPatternEventPatternEventPattern= No additional filtering based on…#
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

Default: No additional filtering based on an event pattern.

roleIRoleRefroleIRoleRefroleIRoleRefRoleIRoleRefRoleIRoleRef= No role associated#
The role that is used for target invocation.

Must be assumable by principal events.amazonaws.com.

ruleNamestringrule_namestrruleNameStringRuleNamestringRuleName*string= AWS CloudFormation generates a u…#
A name for the rule.
default

Default: AWS CloudFormation generates a unique physical ID.

scheduleSchedulescheduleSchedulescheduleScheduleScheduleScheduleScheduleSchedule= None.#
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.

targetsIRuleTarget[]targetstyping.List[IRuleTarget]targetsList<IRuleTarget>TargetsIRuleTarget[]Targets*[]IRuleTarget= No targets.#
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]).

Used as props by ​