Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a location constraint for bucket creation. #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sonoransun
Copy link
Contributor

The only region where a location constraint is not required is us-east-1.

@@ -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})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should set this to default to eu-west-1 if the paramter is missing in the env? I think that would make line 11 region = os.getenv('AWS_DEFAULT_REGION', 'eu-west-1')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants