[CP] Disables IMDS to prevent auto-region detection during S3ClientConfiguration construction

This commit is contained in:
obdev
2024-06-17 20:33:39 +00:00
committed by ob-robot
parent 8cf399af82
commit 5444e47b61

View File

@ -136,8 +136,13 @@ int ObS3Client::init_s3_client_configuration_(const ObS3Account &account,
int ObS3Client::init(const ObS3Account &account)
{
int ret = OB_SUCCESS;
void *client_buf = NULL;
S3ClientConfiguration config;
void *client_buf = nullptr;
// Disables IMDS to prevent auto-region detection during construction.
ClientConfigurationInitValues init_values;
init_values.shouldDisableIMDS = true;
S3ClientConfiguration config(init_values);
// Re-enables IMDS access for subsequent operations if needed
config.disableIMDS = false;
Aws::Auth::AWSCredentials credentials(account.access_id_, account.secret_key_);
SpinWLockGuard guard(lock_);
if (OB_UNLIKELY(is_inited_)) {