fix: s3 bucket operations in V2#5803
Merged
zhaoqizqwang merged 4 commits intoaws:master-v2from Apr 29, 2026
Merged
Conversation
Add ExpectedBucketOwner to S3 data-plane calls
Collaborator
Author
|
The failed tests are flaky and not caused by code changes in this PR: |
jam-jee
approved these changes
Apr 29, 2026
mujtaba1747
reviewed
Apr 29, 2026
| get_kwargs = {"Bucket": bucket, "Key": key} | ||
| expected_owner = self.predictor_async.sagemaker_session._get_account_id_if_default_bucket(bucket) | ||
| if expected_owner: | ||
| get_kwargs["ExpectedBucketOwner"] = expected_owner |
Collaborator
There was a problem hiding this comment.
nit: This pattern of passing kwargs is repeated throughout the PR.
Is this the best way to do this?
Can we just pass ExpectedBucketOwner = None to the s3 client if the _get_account_id_if_default_bucket returns None?
Collaborator
There was a problem hiding this comment.
Previous way of calling the s3 client looked way cleaner IMO.
|
|
||
| # Explicitly passing a None kms_key to boto3 throws a validation error. | ||
| s3_object = s3.get_object(Bucket=bucket, Key=key_prefix) | ||
| s3_object = s3.get_object(**get_kwargs) |
Collaborator
There was a problem hiding this comment.
Same pattern of kwargs repeated throughout the codebase. What does documentation say about this and possible other options?
| # rather than block the S3 operation. | ||
| LOGGER.warning( | ||
| "Could not resolve caller account id for ExpectedBucketOwner check " | ||
| "on bucket %s; proceeding without the check.", |
Collaborator
There was a problem hiding this comment.
Why are we swallowing the exception here? Are we ok with the check failing silently in this case?
lucasjia-aws
added a commit
to lucasjia-aws/sagemaker-python-sdk-lucas
that referenced
this pull request
May 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ExpectedBucketOwner to S3 data-plane calls
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.