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 ​

crossStackScopeoptionalConstructcross_stack_scopeoptionalConstructcrossStackScopeoptionalConstructCrossStackScopeoptionalConstructCrossStackScopeoptionalConstruct#
The scope to use if the source of the rule and its target are in different Stacks (but in the same account & region).

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

This helps dealing with cycles that often arise in these situations.

descriptionoptionalstringdescriptionoptionalstrdescriptionoptionalStringDescriptionoptionalstringDescriptionoptional*string#
A description of the rule's purpose.

Default: No description

enabledoptionalbooleanenabledoptionalboolenabledoptionalBooleanEnabledoptionalboolEnabledoptional*bool= true#
Indicates whether the rule is enabled.
eventBusoptionalIEventBusRefevent_busoptionalIEventBusRefeventBusoptionalIEventBusRefEventBusoptionalIEventBusRefEventBusoptionalIEventBusRef#
The event bus to associate with this rule.

Default: The default event bus.

eventPatternoptionalEventPatternevent_patternoptionalEventPatterneventPatternoptionalEventPatternEventPatternoptionalEventPatternEventPatternoptionalEventPattern#
Additional restrictions for the event to route to the specified target.

Default: No additional filtering based on an event pattern.

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.

roleoptionalIRoleRefroleoptionalIRoleRefroleoptionalIRoleRefRoleoptionalIRoleRefRoleoptionalIRoleRef#
The role that is used for target invocation.

Default: No role associated

Must be assumable by principal events.amazonaws.com.

ruleNameoptionalstringrule_nameoptionalstrruleNameoptionalStringRuleNameoptionalstringRuleNameoptional*string#
A name for the rule.

Default: AWS CloudFormation generates a unique physical ID.

scheduleoptionalSchedulescheduleoptionalSchedulescheduleoptionalScheduleScheduleoptionalScheduleScheduleoptionalSchedule= 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.

targetsoptionalIRuleTarget[]targetsoptionaltyping.List[IRuleTarget]targetsoptionalList<IRuleTarget>TargetsoptionalIRuleTarget[]Targetsoptional*[]IRuleTarget#
Targets to invoke when this rule matches an event.

Default: No targets.

Input will be the full matched event. If you wish to specify custom target input, use addTarget(target[, inputOptions]).