Unable to override IMDSv2 service URL #2847
Labels
feature-request
A feature should be added or improved.
p2
This is a standard priority issue
queued
This issues is on the AWS team's backlog
Describe the bug
I'm using aws_signing_helper in order to facilitate IAM Roles Anywhere setup.
I'm overriding AWS_EC2_METADATA_SERVICE_ENDPOINT to http://127.0.0.1:9911/
However, the application doesn't use the new endpoint and still trying to fetch InstanceCredentials from 169.254.169.254.
Expected Behavior
The application would acquire temporary credentials from aws_signing_helper via IAM Roles Anywhere by talking to a service endpoint defined by the environment variable AWS_EC2_METADATA_SERVICE_ENDPOINT.
Current Behavior
The application fails to authenticate with an error of
Error retrieving credentials from the instance profile metadata service. (cURL error 7: Failed to connect to 169.254.169.254 port 80: Network is unreachable (see https://curl.haxx.se/libcurl/c/libcurl-errors.html))
clearly indicating the old address for instance metadata.
Reproduction Steps
AWS_EC2_METADATA_SERVICE_ENDPOINT
Possible Solution
Re-implement #2277 after it has been reverted.
Additional Information/Context
I think the problem is that URL is hardcoded in https://github.com/SamRemis/aws-sdk-php/blob/master/src/Credentials/InstanceProfileProvider.php#L19 and https://github.com/SamRemis/aws-sdk-php/blob/master/src/Credentials/InstanceProfileProvider.php#L230
SDK version used
3.290.1
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)php 8.1
The text was updated successfully, but these errors were encountered: