Disable loading EC2-metadata.

This commit is contained in:
Vitaly Baranov 2022-12-22 02:49:08 +01:00
parent f8f598e298
commit 1eb0d5db16
2 changed files with 7 additions and 1 deletions

2
contrib/aws vendored

@ -1 +1 @@
Subproject commit 94a1629472778e3b5c5c08866eaf95ea77cbc336
Subproject commit e15b0695c5b3c0f8dc15c89b5e7eb73b2747fdec

View File

@ -677,6 +677,12 @@ namespace S3
ClientFactory::ClientFactory()
{
aws_options = Aws::SDKOptions{};
/// We don't load EC2 metadata.
/// This is needed to allow to subclass `ClientConfiguration` so that any possible SDK client will use extended configuration
/// without circular dependencies `Client` -> `ClientConfiguration` -> `Client`.
setenv("AWS_EC2_METADATA_DISABLED", "true", 1/*override*/); // NOLINT(concurrency-mt-unsafe): this is safe if not called concurrently
Aws::InitAPI(aws_options);
Aws::Utils::Logging::InitializeAWSLogging(std::make_shared<AWSLogger>(false));
Aws::Http::SetHttpClientFactory(std::make_shared<PocoHTTPClientFactory>());