-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 crt client doesn't pick up the default region #1768
Comments
Hi @dhananjays , The s3-crt default provider chain is reduced to make it faster to go through, and it will only check for the region in the |
Here is how we back-ported that in our code, since we ran into the same issue: the CRT does not pickup Aws::S3Crt::ClientConfiguration config;
// ...
config.region = []() -> Aws::String {
// Return the configured AWS region, using us-east-1 as fallback. This is normally part
// of Aws::Client::ClientConfiguration, but is not implemented for the S3CrtClient.
Aws::String region = os::getenv("AWS_DEFAULT_REGION");
if (!region.empty()) {
return region;
}
region = os::getenv("AWS_REGION");
if (!region.empty()) {
return region;
}
// The profile may also contain a region value.
if (Aws::Config::HasCachedCredentialsProfile("default")) {
region = Aws::Config::GetCachedCredentialsProfile("default").GetRegion();
if (!region.empty()) {
return region;
}
}
return Aws::Region::US_EAST_1;
}(); |
The problem is also resolved by #1884. |
Merged: #2098 |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Thank you. |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
S3-crt client doesn't automatically get the region unlike the S3 client which automatically fetches region (using the chain of AWS_DEFAULT_REGION -> profile -> instance metadata). The user is forced to provide the correct region when creating the s3-crt client
SDK version number
1.9
Platform/OS/Hardware/Device
EC2 Linux instance
To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code)
Create S3 client without setting region in the client config. It automatically picks up the default region from the profile/instance metadata (This is as expected from version 1.8 as mentioned here - https://aws.amazon.com/blogs/developer/aws-sdk-for-c-version-1-8-developer-preview/)
Create S3-crt client without setting region in the client config. It does not pick the default region as expected.
Expected behavior
S3-crt client should automatically pick up the default region as done by the S3 client
The text was updated successfully, but these errors were encountered: