Skip to content

Commit 517bab5

Browse files
authored
fix: Remove unnecessary configuration from S3 bucket creation (#1234)
1 parent ca26dfa commit 517bab5

2 files changed

Lines changed: 1 addition & 39 deletions

File tree

src/braket/aws/aws_session.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -576,36 +576,7 @@ def _create_s3_bucket_if_it_does_not_exist(self, bucket_name: str, region: str)
576576
self.s3_client.create_bucket(
577577
Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": region}
578578
)
579-
self.s3_client.put_public_access_block(
580-
Bucket=bucket_name,
581-
PublicAccessBlockConfiguration={
582-
"BlockPublicAcls": True,
583-
"IgnorePublicAcls": True,
584-
"BlockPublicPolicy": True,
585-
"RestrictPublicBuckets": True,
586-
},
587-
)
588-
self.s3_client.put_bucket_policy(
589-
Bucket=bucket_name,
590-
Policy=f"""{{
591-
"Version": "2012-10-17",
592-
"Statement": [
593-
{{
594-
"Effect": "Allow",
595-
"Principal": {{
596-
"Service": [
597-
"braket.amazonaws.com"
598-
]
599-
}},
600-
"Action": "s3:*",
601-
"Resource": [
602-
"arn:aws:s3:::{bucket_name}",
603-
"arn:aws:s3:::{bucket_name}/*"
604-
]
605-
}}
606-
]
607-
}}""",
608-
)
579+
609580
except ClientError as e:
610581
error_code = e.response["Error"]["Code"]
611582
message = e.response["Error"]["Message"]

test/unit_tests/braket/aws/test_aws_session.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,15 +1189,6 @@ def test_create_s3_bucket_if_it_does_not_exist(aws_session, region, account_id):
11891189
if region == "us-east-1":
11901190
del kwargs["CreateBucketConfiguration"]
11911191
aws_session._s3.create_bucket.assert_called_with(**kwargs)
1192-
aws_session._s3.put_public_access_block.assert_called_with(
1193-
Bucket=bucket,
1194-
PublicAccessBlockConfiguration={
1195-
"BlockPublicAcls": True,
1196-
"IgnorePublicAcls": True,
1197-
"BlockPublicPolicy": True,
1198-
"RestrictPublicBuckets": True,
1199-
},
1200-
)
12011192

12021193

12031194
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)