aws-events-target: support adding CloudWatchLogGroup rule target without creation of new Resource Policy #31404
Labels
@aws-cdk/aws-events-targets
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
The user should be able to override the creation of a new CloudWatch Log Resource Policy when defining a Log Group as the target of an EventBridge rule.
Use Case
When a CloudWatch LogGroup is defined as the target of an EventBridge rule, CDK creates a CloudWatch Log Resource Policy in order to allow EventBridge to write events to CloudWatch. Since there is a hard limit of 10 CloudWatch Log Resource Policies per account per region, this is limiting the amount of EventBridge rules that can be logged to CloudWatch, especially considering one Resource Policy should be able to dictate access to EventBridge to write to several Log Groups.
Consider the following policies that were created by CDK:
These three CloudWatch Logs Resource Policies can be simplified and replaced by just one policy:
Proposed Solution
A property could be added to LogGroupProps interface (below) which allows the consumer to opt out of the Resource Policy creation.
aws-cdk/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts
Lines 62 to 89 in 1e20375
Then in the if statement (below) which checks for the existence of the Resource Policy CDK is trying to create, a condition could be added to that check to see whether the new property is true or false.
aws-cdk/packages/aws-cdk-lib/aws-events-targets/lib/log-group.ts
Lines 118 to 128 in 1e20375
Other Information
No response
Acknowledgements
CDK version used
2.157.0
Environment details (OS name and version, etc.)
macOS Ventura 13.4 (Intel processor)
The text was updated successfully, but these errors were encountered: