aws-sdk-cpp
aws-sdk-cpp copied to clipboard
How to process the warning about http://169.254.169.254
Describe the bug
There are following warnings when I trigger http request, the http response is success, how to solve these warnings? [Warning] (AwsNativeSDK) - [AWS] ClientConfiguration - Retry Strategy will use the default max attempts. [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Failed setting TCP keep-alive interval with error code: 12018 [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Failed to add HTTP request headers with error code: 12150 [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Send request failed: [Warning] (AwsNativeSDK) - [AWS] EC2MetadataClient - Http request to retrieve credentials failed [Warning] (AwsNativeSDK) - [AWS] EC2MetadataClient - Request failed, now waiting 0 ms before attempting again. [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Failed setting TCP keep-alive interval with error code: 12018 [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Failed to add HTTP request headers with error code: 12150 [Warning] (AwsNativeSDK) - [AWS] WinHttpSyncHttpClient - Send request failed: [Warning] (AwsNativeSDK) - [AWS] EC2MetadataClient - Http request to retrieve credentials failed [Warning] (AwsNativeSDK) - [AWS] EC2MetadataClient - Can not retrieve resource from http://169.254.169.254/latest/meta-data/placement/availability-zone
Expected Behavior
There is no warning when request a http url successfully.
Current Behavior
There are some warnings when I trigger a http request.
Reproduction Steps
User CreateHttpRequest to trigger a http request.
Possible Solution
No response
Additional Information/Context
No response
AWS CPP SDK version used
AWSNativeSDK-1.9.50-rev2-windows
Compiler and Version used
Visual Studio 2019
Operating System and version
Windows 10
Here is an example of how to process a warning from an http request:
auto request = Aws::Http::CreateHttpRequest(Aws::String(
"https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/samples/moviedata.zip"),
Aws::Http::HttpMethod::HTTP_GET,
Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
request->SetUserAgent("curl/7.79.1");
std::cout << "Downloading the json file." << std::endl;
auto response = httpClient->MakeRequest(request);
if (Aws::Http::HttpResponseCode::OK == response->GetResponseCode()) {
{
That is for dynamodb, but I would assume your request would look similar. You also said that you expect no warning, but a few things could be causing that. Can you make sure you have the correct credentials and that they have the resource that you are trying to access. Please include a minimal code snippet that reproduces this error if you are still running into the problem.
Also you can set the environment variable AWS_EC2_METADATA_DISABLED to true to turn off the warning that you are seeing
http://169.254.169.254/latest/meta-data/placement/availability-zone is used in some test cpp. Is there any other effect after setting the environment variable AWS_EC2_METADATA_DISABLED to true?
You can search this sdk for all of the uses of AWS_EC2_METADATA_DISABLED. But I think the answer to your question is no, there are no other effects from setting this variable to true.
For example look in this file to see what is effected by this variable.
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.