Skip to content

C++ support AWS_METADATA_SERVICE_TIMEOUT #3493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

C++ support AWS_METADATA_SERVICE_TIMEOUT #3493

wants to merge 1 commit into from

Conversation

kai-ion
Copy link

@kai-ion kai-ion commented Jul 23, 2025

Issue #, if available:

Description of changes:
Implement a new configuration support for IMDS (Instance Metadata Service), specifically support for environment variable AWS_METADATA_SERVICE_TIMEOUT and AWS_METADATA_SERVICE_NUM_ATTEMPTS . Reference for Amazon EC2 instance metadata.

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@kai-ion kai-ion force-pushed the cailinn branch 2 times, most recently from a1482df to 35b7c3a Compare July 25, 2025 15:35
Copy link
Contributor

@sbiscigl sbiscigl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you dont actually pass the configuration to the credentials provider chain initialization so it wont be used. we need that to happen so that the value is used.

@kai-ion kai-ion force-pushed the cailinn branch 2 times, most recently from 626c3d9 to 2da1529 Compare July 29, 2025 20:13
Add ClientConfiguration support for IMDS settings and update related classes

Fix: Shared pointer bug in AWSCredentialsProvider

allocator mismatch bug fix, change type using c_str()

new configuration support for IMDSConfig

Add ClientConfiguration support for IMDS settings and update related classes

Fix: Shared pointer bug in AWSCredentialsProvider

allocator mismatch bug fix, change type using c_str()

Fix shared pointer bug and update IMDS config structure

- Fix std::stol compilation error with Aws::String by using .c_str()
- Update IMDS configuration to use credentialProviderConfig.imdsConfig structure
- Add proper environment variable support for AWS_METADATA_SERVICE_TIMEOUT and AWS_METADATA_SERVICE_NUM_ATTEMPTS

Update IMDS configuration and credentials provider

fix: Remove duplicate IMDS config struct and fix comment syntax

feat: Add IMDS configuration support to credential provider chain

- Add CredentialProviderConfiguration struct with IMDS timeout and retry settings
- Add constructor to DefaultAWSCredentialsProviderChain accepting CredentialProviderConfiguration
- Add constructor to InstanceProfileCredentialsProvider accepting CredentialProviderConfiguration
- Add constructor to EC2InstanceProfileConfigLoader accepting CredentialProviderConfiguration
- Add constructor to EC2MetadataClient accepting CredentialProviderConfiguration with IMDS timeout/retry configuration
- Enable IMDS configuration to flow through: CredentialProviderConfiguration → InstanceProfileCredentialsProvider → EC2InstanceProfileConfigLoader → EC2MetadataClient
- Reduce object creation redundancy by passing configuration directly through the chain

fix disableImdsvV1 member

added new include

feat: Add IMDS configuration support for AWS_METADATA_SERVICE_TIMEOUT

Add support for AWS_METADATA_SERVICE_TIMEOUT and AWS_METADATA_SERVICE_NUM_ATTEMPTS
environment variables and config file settings to configure IMDS client behavior.

- Add imdsConfig struct to ClientConfiguration.credentialProviderConfig
- Support AWS_METADATA_SERVICE_TIMEOUT env var and metadata_service_timeout config
- Support AWS_METADATA_SERVICE_NUM_ATTEMPTS env var and metadata_service_num_attempts config
- Add InstanceProfileCredentialsProvider constructor accepting ClientConfiguration
- Add EC2InstanceProfileConfigLoader constructor accepting CredentialProviderConfiguration
- Update EC2MetadataClient to use configured timeout and retry values
- Use StringUtils::ConvertToInt32 for parsing instead of std::stol

Resolves customer request for configurable IMDS timeout settings.

fixed snake case

removed m_disableIMDSV1 and comment

recreated retry strategy during client configuration

updated forward declaration

fixed nip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants