fix: Remove ExpectedBucketOwner parameter from create_bucket method #334
+4
−10
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.
Description
The
ExpectedBucketOwnerparameter is not supported by the S3create_bucketAPI call. It is only valid for operations on existing buckets (likeput_bucket_lifecycle_configuration,head_bucket, etc).This fix removes the unsupported parameter from both
us-east-1and regional bucket creation calls, resolving API errors during bucket creation.Fixes #330
Related to PR #331
Type of Change
Changes Made
Source Code (
src/bedrock_agentcore_starter_toolkit/services/s3.py)ExpectedBucketOwnerparameter fromcreate_bucket()call forus-east-1regionExpectedBucketOwnerparameter fromcreate_bucket()call for other regionsExpectedBucketOwnerinput_bucket_lifecycle_configuration()where it is validTests (
tests/services/test_s3.py)test_create_bucket_us_east_1assertion to match corrected API calltest_create_bucket_other_regionassertion to match corrected API callTesting
Test Results
Checklist
Security Checklist
Breaking Changes
None. This is a bug fix that corrects API usage to match AWS S3 API specifications.
Additional Notes
The
ExpectedBucketOwnerparameter is documented in the AWS S3 API as only being valid for operations on existing buckets, not bucket creation. This fix aligns the code with the official API specification.AWS S3 API Reference:
create_bucketdoes not acceptExpectedBucketOwner: https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.htmlput_bucket_lifecycle_configurationdoes acceptExpectedBucketOwner: https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html