metadata_service_num_attempts - AWS SDKs and Tools

metadata_service_num_attempts

Specifies the number of attempts to make before giving up when attempting to retrieve data from the instance metadata service.

Details

When attempting to retrieve credentials on an Amazon EC2 instance that has been configured with an IAM role, the connection to the instance metadata service is attempted only once by default. If you know you're running on an Amazon EC2 instance with an IAM role configured, you can increase this value so that any intermittent failures are retried.

Ways to set this value

Location Supported Example
config file Yes
metadata_service_num_attempts=10
credentials file -
Environment variable Yes Linux/macOS
export AWS_METADATA_SERVICE_NUM_ATTEMPTS=10
Windows
setx AWS_METADATA_SERVICE_NUM_ATTEMPTS 10
AWS CLI parameter -

Compatibility with AWS SDKS and tools