Skip to content

Commit

Permalink
Add a location constraint for bucket creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Peck committed Mar 7, 2024
1 parent 6269f46 commit 0005a20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def upload_file_to_s3(bucket: str, filename: str):
except ClientError as e:
if e.response['Error']['Code'] == 'NoSuchBucket' or int(e.response['Error']['Code']) in [403, 404]:
# Create the bucket since it does not exist
s3_client.create_bucket(Bucket=bucket)
s3_client.create_bucket(Bucket=bucket, CreateBucketConfiguration={'LocationConstraint': region})
logger.info(f'Created bucket {bucket} in MinIO.')
else:
# Other errors like permissions issues
Expand Down

0 comments on commit 0005a20

Please sign in to comment.