Skip to content

Commit

Permalink
Remove unnecessary manual retrieval of AWS credentials.
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-tsirpanis committed Sep 6, 2024
1 parent ef7aba6 commit 074035f
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions tiledb/sm/filesystem/s3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,10 @@ Status S3::init_client() const {

std::lock_guard<std::mutex> lck(client_init_mtx_);

if (client_ != nullptr) {
return Status::Ok();
}

auto s3_config_source = s3_params_.config_source_;
if (s3_config_source != "auto" && s3_config_source != "config_files" &&
s3_config_source != "sts_profile_with_web_identity") {
Expand All @@ -1327,22 +1331,6 @@ Status S3::init_client() const {
"'sts_profile_with_web_identity'");
}

if (client_ != nullptr) {
// Check credentials. If expired, refresh it
if (credentials_provider_) {
Aws::Auth::AWSCredentials credentials =
credentials_provider_->GetAWSCredentials();
if (credentials.IsExpired()) {
throw S3Exception("AWS credentials are expired.");
} else if (!s3_params_.no_sign_request_ && credentials.IsEmpty()) {
throw S3Exception(
"AWS credentials were not provided. For public S3 data, consider "
"setting the vfs.s3.no_sign_request config option.");
}
}
return Status::Ok();
}

// ClientConfiguration should be lazily init'ed here in init_client to avoid
// potential slowdowns for non s3 users as the ClientConfig now attempts to
// check for client configuration on create, which can be slow if aws is not
Expand Down

0 comments on commit 074035f

Please sign in to comment.