aws / aws/aws-cdk

(aws-s3): Suppress info log for cross-account replication configuration in S3

Open
#34,773 2 comments 2 reactions 0 assignees View on GitHub
@aws-cdk/aws-s3 effort/medium feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

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

Contributor guide

Open the contributing guide

Research direction

Start in packages/aws-cdk-lib/aws-s3/lib/bucket.ts at lines 2997-2999, then compare the existing addWarningV2() behavior referenced in the proposal. Determine whether the cross-account replication info message should be suppressible or removed, and confirm that synthesis no longer emits misleading guidance after permissions are configured.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.