Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Usage
* ``s3:PutBucketCORS``
* ``s3:PutBucketVersioning``
* ``iam:CreateAccessKey``
* ``s3:PutBucketOwnershipControls``

2. After you set that up, you can type ``buckup`` and that should open the
prompt.
Expand Down
17 changes: 15 additions & 2 deletions buckup/bucket_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,21 @@ def set_bucket_policy(
"RestrictPublicBuckets": not public_access,
},
)
if public_access or allow_public_acls:
print("Configured public access to bucket.")

# NB: This API doesn't exist on a `Bucket`
self.s3_client.put_bucket_ownership_controls(
Bucket=bucket.name,
OwnershipControls={
# "BucketOwnerPreferred" = ACLs enabled. "BucketOwnerEnforced" = ACLs disabled.
"Rules": [
{
"ObjectOwnership": "BucketOwnerPreferred"
if allow_public_acls
else "BucketOwnerEnforced"
}
]
},
)

policy_statement = list(
self.get_bucket_policy_statements_for_user_access(bucket, user)
Expand Down
Loading