EventBridge Rule Disabled or Has No Targets
eventbridge-rule-no-targets
What this rule checks
Detects EventBridge rules that are disabled or have no targets configured, so matched events are silently dropped.
How to fix it
- 1Enable the rule (set State to ENABLED)
- 2Attach at least one target to the rule
import { Duration } from 'aws-cdk-lib';
import * as events from 'aws-cdk-lib/aws-events';
// inside your Stack
new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(Duration.hours(1)),
});import { Duration } from 'aws-cdk-lib';
import * as events from 'aws-cdk-lib/aws-events';
import * as targets from 'aws-cdk-lib/aws-events-targets';
import * as sns from 'aws-cdk-lib/aws-sns';
// inside your Stack
const topic = new sns.Topic(this, 'Topic');
new events.Rule(this, 'Rule', {
schedule: events.Schedule.rate(Duration.hours(1)),
targets: [new targets.SnsTopic(topic)],
});CDK Insights pinpoints the exact file and line in your CDK source for every finding, so you can jump straight to the fix.
Affected resource types
AWS::Events::RuleIntentional? Suppress this finding
Sometimes a flag is deliberate โ a genuinely public endpoint, say. You can dismiss eventbridge-rule-no-targets and the reason is kept in the report, not silently hidden.
In .cdk-insights.json:
{
"ignoreRules": [
{ "id": "eventbridge-rule-no-targets", "reason": "Why this is intentional" }
]
}Or inline in your CDK code:
Validations.of(scope).acknowledge({
id: 'cdk-insights::eventbridge-rule-no-targets',
reason: 'Why this is intentional',
});Use the rule ID eventbridge-rule-no-targets shown above โ not the CDK-* ID from SARIF / GitHub code scanning. To dismiss every finding on one construct instead, use ignorePaths. Suppression docs โ
Catch this in your stack
$ npx cdk-insights scanCDK Insights runs this and 126+ other rules locally against your synthesised CDK app โ free, no account, your code never leaves your machine.