-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
S3: Ensure connection to the well-defined region #14
Conversation
I'm not sure what does this mean exactly ? What would be the value of |
When you don't specify a region, AWS for compat reasons will suppose you're in us-east-1 AFAIK, if region = "US", it'll set also us-east-1, if you set region = "EU", it'll set eu-west-1 IIRC. Anyway, for backward compatibility, AWS will gladly take no region and give you the "default" regional S3, which is in most of the case us-east-1. So when you go out of the default region, it will break because you cannot create from a regional S3 an S3 Bucket outside of the specified region which what the current code does:
|
I still don't see how the issue happens exactly. Maybe to make it easier, what would be the steps to reproduce the issue you're describing ? |
Try to create an S3 Bucket in the region Sure, I'm not used to how So my easy fix is just to always use |
if region == "eu-west-1": return "EU" | ||
elif region == "us-east-1": return "US" | ||
else: return region | ||
|
||
def region_name_to_region(region): | ||
if region == "EU": return "eu-west-1" | ||
elif region == "US": return "us-east-1" | ||
else: return region |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if possible we should get rid of all these US/us-east-1, EU/eu-west-1 default stuff and always specify the region in the boto3 request since it is already required. cc @AmineChikhaoui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PsyanticY I can do it in this PR if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AmineChikhaoui should decide that ^^
I was able to create a bucket in us-west-1 without any issue. |
Okay, I'll come up with a repro case then. |
@RaitoBezarius @AmineChikhaoui While you're looking into this, please look at the related https://github.com/NixOS/nixops/issues/1215 |
It turns out that this fixes NixOS/nixops#1215. Please merge it ! |
@NorfairKing I didn't have any time to reproduce the bug, do you have some repro case at the hand? |
Here you go:
|
@RaitoBezarius I'd like to get this merged. |
I'd love to merge it, @NorfairKing — but @AmineChikhaoui would need to reproduce it. |
For the example you've mentioned @NorfairKing , the issue was related to the bucket name containing upper case characters (
Ref : https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html#bucketnamingrules For the other example referenced by #88 , the bucket |
@tewfik-ghariani So it looks like my examples weren't good. |
@NorfairKing I mean that I noticed this could potentially be a false problem. Could you give it one more try while abiding to the bucket naming requirements? |
@tewfik-ghariani Not really, I aleady started using the fork and that fixes my problem, so I definitely use a sensible bucket name right now. I'd prefer not to revert my setup and create additional buckets. |
Could we please merge this at some point? @RaitoBezarius |
I will close this PR as I believe it has too much diverged from the source tree ; if the bug still remains, feel free to start a new PR based on this. |
Currently, if you try to create a S3 Bucket out of a "default region" (US/EU), you'll get an error because
self.region
is equal toNone
during creation, we should use the definition rather and storedefn.region
inself.region
, this PR fixes the behavior.I am open to all pointers to make this solution more NixOps-y.