Given that the httpfs extension still uses v4 signing for auth so AWS_REGION is a required paramter to be passed to access a S3 file, we should set it through the extension so that users don't have to separately set it using the SET command.
My experimentation with this code snippet worked for extracting AWS_REGION from my local ~/.aws/credentials file but I'm unfamiliar with AWS SDK so just a suggestion:
#include <aws/core/client/ClientConfiguration.h>
...
string ret;
if (!credentials.IsExpiredOrEmpty()) {
config.SetOption("s3_access_key_id", Value(credentials.GetAWSAccessKeyId()));
config.SetOption("s3_secret_access_key", Value(credentials.GetAWSSecretKey()));
// Extract and set AWS_REGION
Aws::Client::ClientConfiguration s3_config(profile.c_str());
auto region = s3_config.region;
config.SetOption("s3_region", Value(region));
config.SetOption("s3_session_token", Value(credentials.GetSessionToken()));
ret = credentials.GetAWSAccessKeyId();
}
...
Given that the httpfs extension still uses v4 signing for auth so AWS_REGION is a required paramter to be passed to access a S3 file, we should set it through the extension so that users don't have to separately set it using the SET command.
My experimentation with this code snippet worked for extracting
AWS_REGION
from my local~/.aws/credentials
file but I'm unfamiliar with AWS SDK so just a suggestion: