-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
AWS_EC2_METADATA_SERVICE_ENDPOINT
port is ignored
#2997
Comments
The environment variable is checked when fetching credentials, it exists in From your output and testing, it is indeed getting the endpoint 127.0.0.1 however the port does appear to not be correct. I checked also with EC2Metadata and it is the same behavior. Both classes do support an ip_address/endpoint option and a port option. I will investigate the designs for these and see if this is correct behavior or not. May I ask your use case on why you are using a custom metadata endpoint? |
Checking other SDKs here, this does appear to be a bug. I've put out a PR to fix this and it should be released by EOD today. In the mean time, you can use the |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Thanks for fixing that!
Some utilities (e.g. aws-vault) allow simulating local IMDS servers for credentials in development, but running it to match the default endpoint and port requires admin-level permissions. Being able to change the port is required for running it without net admin privileges (and I might want to use port 80 for other things locally anyway) |
Describe the bug
When I set a port as part of the
AWS_EC2_METADATA_SERVICE_ENDPOINT
environment variable, I expect the IMDS credential provider to attempt to get credentials using that hostname/port combo.Expected Behavior
AWS_EC2_METADATA_SERVICE_ENDPOINT=http://127.0.0.1:9099
, should result in fetching credentials from127.0.0.1:9099
(not the default port, 80)Current Behavior
Reproduction Steps
Gemfile
repro.rb
Possible Solution
Try using
uri.port
first in:aws-sdk-ruby/gems/aws-sdk-core/lib/aws-sdk-core/ec2_metadata.rb
Line 186 in 64ad62e
Or, default
@port
tonil
.Additional Information/Context
No response
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-core
3.191.4Environment details (Version of Ruby, OS environment)
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
The text was updated successfully, but these errors were encountered: