(aws-s3-deployment): (eventBridgeEnabled: true causes bucket policy explosion)
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
Enabling eventBridge for multiple s3 buckets in a single stack is causing deployment failure with message "Maximum policy size of 10240 bytes exceeded for role XXXStack-BucketNotificationsHander050a05-xxxxxx"
### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Library Version
_No response_
### Expected Behavior
Should be able to select eventBridgeEnabled: true for multiple buckets (80+) without encountering this error.
### Current Behavior
This is the deployed policies in a non-prod environment with far less s3 buckets
Prod environment has more than a hundred buckets causing the "Maximum policy size of 10240 bytes exceeded" error.
### Reproduction Steps
Create 80+ bucket in a single stack and enable eventBridgeEnabled: true
```new Bucket(
this.scope,
`${xxxx}-reportdocuments-${env}`,
{
blockPublicAccess: BlockPublicAccess.BLOCK_ALL,
encryption: BucketEncryption.S3_MANAGED,
removalPolicy: RemovalPolicy.RETAIN,
versioned: true,
eventBridgeEnabled: true,
}
);
```
### Possible Solution
A way to be able to just create an inline policy for the handler with specified wildcards?
### Additional Information/Context
_No response_
### AWS CDK Library version (aws-cdk-lib)
2.1105
### AWS CDK CLI version
2.1125.0 (build 71fd29e)
### Node.js Version
v24.15.0
### OS
Ubuntu 25.10
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
Start with the aws-s3-deployment eventBridgeEnabled path and reproduce the issue by synthesizing a stack with 80+ buckets. Inspect the generated BucketNotificationsHandler role policies and compare them with the 10240-byte limit. Done means multiple eventBridge-enabled buckets deploy successfully without exceeding the policy size limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- authorization, cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100