Description
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- I've gone though Developer Guide and API reference
- I've searched for previous similar issues and didn't find any solution
Describe the bug
Initialization of the SDK client takes a long time (5s) on PC with empty AWS credentials.
In my environment, I will manually setup the client for using AWS services. No credentials, config files, or environment variables will be used. All credentials will be retrieved from Cognito services during login, etc.
In previous versions of the SDK (~1.7.*) I could normally start the client. In version 1.8.4 it takes about 5 s to execute this simple code:
Aws::SDKOptions options;
Aws::Utils::Logging::LogLevel logLevel{Aws::Utils::Logging::LogLevel::Warn};
options.loggingOptions.logLevel = logLevel;
options.loggingOptions.logger_create_fn = [] { return std::make_shared<Aws::Utils::Logging::ConsoleLogSystem>Aws::Utils::Logging::LogLevel::Warn); };
Aws::InitAPI(options);
Aws::Client::ClientConfiguration config;
AWS_LOGSTREAM_FLUSH();
This is the log output:
[WARN] 2020-07-07 21:38:00.797 ClientConfiguration [10100] Retry Strategy will use the default max attempts.
[WARN] 2020-07-07 21:38:00.801 ClientConfiguration [10100] Retry Strategy will use the default max attempts.
[WARN] 2020-07-07 21:38:00.802 WinHttpSyncHttpClient [10100] Failed setting TCP keep-alive interval with error code: 120
18
[ERROR] 2020-07-07 21:38:00.802 WinHttpSyncHttpClient [10100] Failed to add HTTP request headers with error code: 12150
[WARN] 2020-07-07 21:38:04.803 WinHttpSyncHttpClient [10100] Send request failed: The operation timed out
[ERROR] 2020-07-07 21:38:04.804 EC2MetadataClient [10100] Http request to retrieve credentials failed
[WARN] 2020-07-07 21:38:04.805 EC2MetadataClient [10100] Request failed, now waiting 0 ms before attempting again.
[WARN] 2020-07-07 21:38:04.806 WinHttpSyncHttpClient [10100] Failed setting TCP keep-alive interval with error code: 120
18
[ERROR] 2020-07-07 21:38:04.806 WinHttpSyncHttpClient [10100] Failed to add HTTP request headers with error code: 12150
[WARN] 2020-07-07 21:38:08.803 WinHttpSyncHttpClient [10100] Send request failed: The operation timed out
[ERROR] 2020-07-07 21:38:08.804 EC2MetadataClient [10100] Http request to retrieve credentials failed
[ERROR] 2020-07-07 21:38:08.804 EC2MetadataClient [10100] Can not retrive resource from http://169.254.169.254/latest/me
ta-data/placement/availability-zone
In the debugger, I see it tries to make a request to find a region on this line:
I know there is an environment variable to disable EC2MetadataClient (AWS_EC2_METADATA_DISABLED
), but as I said before, I don't have access to the end user PC and can't force him to set needed variable.
Is it possible to setup AWS region without making any requests and disable EC2MetadataClient direct from code?
SDK version number - 1.8.4
Platform/OS/Hardware/Device
Win 10, VS2017, x64