-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(s3): cannot deploy multiple replication source buckets (under feature flag) #33360
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33360 +/- ##
=======================================
Coverage 81.00% 81.00%
=======================================
Files 238 238
Lines 14271 14271
Branches 2492 2492
=======================================
Hits 11560 11560
Misses 2425 2425
Partials 286 286
Flags with carried forward coverage won't be shown. Click here to find out more.
|
How does this work in a scenario where multiple stages are deployed to 1 account? So we have 2 buckets from the TEST stage being replicated and 2 buckets from the PRD stage being replicated? Will they use the same role? And what if the replication is cross-account? I was more thinking along the lines of adding an optional BTW, https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L2853 appears to be confusing the buckets: |
@jochemd
One replication role is generated for each source bucket, regardless of stage differences or whether cross-account access is involved.
Since one replication role executes replication according to multiple replication rules, it seems difficult to simply add a
Oh! I've not realized this. I'll resolve this problem in another PR. |
@jochemd From my perspective, since the current implementation is problematic, I think it would be best to first merge this PR to remove the hardcoded role name, and then create a new PR as a new feature to accept an optional replication role. |
Sounds good to me. Unfortunately I am not able to give an actual review or serious testing of this PR as when I try to go through the steps in the contributing guide I get errors on the linking step. |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
### Issue # (if applicable) None ### Reason for this change As mentioned in [this comment](#33360 (comment)), the annotation phrase is incorrect and may confuse users. The `addReplicationPolicy()` function works to add a resource policy for the destination bucket, but the annotation phrase says source bucket. ### Description of changes ```diff - For Cross-account S3 replication, ensure to set up permissions on source bucket using method addReplicationPolicy() + For Cross-account S3 replication, ensure to set up permissions on destination bucket using method addReplicationPolicy() ``` ### Describe any new or updated permissions being added None ### Description of how you validated changes None ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
) ### Issue # (if applicable) None ### Reason for this change As mentioned in [this comment](aws#33360 (comment)), the annotation phrase is incorrect and may confuse users. The `addReplicationPolicy()` function works to add a resource policy for the destination bucket, but the annotation phrase says source bucket. ### Description of changes ```diff - For Cross-account S3 replication, ensure to set up permissions on source bucket using method addReplicationPolicy() + For Cross-account S3 replication, ensure to set up permissions on destination bucket using method addReplicationPolicy() ``` ### Describe any new or updated permissions being added None ### Description of how you validated changes None ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Issue # (if applicable)
Closes #33355.
Reason for this change
We cannot deploy multiple source buckets for object replication due to the explicitly set replication role name.
Description of changes
Set replication role name by
PhysicalName.GENERATE_IF_NEEDED
.Describe any new or updated permissions being added
None
Description of how you validated changes
Update both unit and integ test.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license