Description
Describe the feature
When configuring replicationRules for an S3 bucket with a cross-account destination, the following info log is always emitted during synthesis:
For Cross-account S3 replication, ensure to set up permissions on destination bucket using method addReplicationPolicy()
This message is helpful during the initial setup of cross-account replication. However, even after the required permissions have already been configured on the destination bucket using addReplicationPolicy(), this message continues to be displayed unconditionally in the source bucket's stack.
This can be misleading, especially for users unfamiliar with the internal implementation, as it suggests that further configuration is still required—even when it isn’t.
To improve the developer experience, I propose either:
- Providing a way to suppress this log once the user has verified their setup.
- Or, conditionally emitting the log only when the destination bucket's permissions have not been configured (if such detection is feasible).
- Or, simply removing the log altogether if it cannot be made context-aware.
Use Case
Even after explicitly calling addReplicationPolicy() on the destination bucket and confirming that the IAM permissions are correct, the log continues to be emitted. This persistent message can cause confusion, prompting users to investigate or second-guess a setup that is already correct.
Reducing or suppressing this unnecessary log output would improve clarity, especially for teams working in multi-account environments where cross-account replication is a common and well-understood pattern.
Proposed Solution
- Implement an addInfoV2() method (similar to addWarningV2()) that allows info messages to be acknowledged and suppressed in future synths.
- Refactor the current implementation to use this new method for this particular log line.
Alternatively, consider removing the log entirely. The current log originates from this line in the source code:
https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L2997-L2999
Other Information
This doesn't appear to be a bug per se, but also doesn't strictly fall under a new feature request. Since I wasn't sure of the most appropriate category, I've filed it as a Feature Request. Please feel free to reclassify it if another label fits better.
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS CDK Library version (aws-cdk-lib)
2.200.1
AWS CDK CLI version
2.1017.1
Environment details (OS name and version, etc.)
AmazonLinux2023