-
Notifications
You must be signed in to change notification settings - Fork 268
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
Misleading 404 logs in IMDS mode when querying EC2 Metadata without a public IP #1058
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Xabier Napal <xabier.napal@dvzr.io>
Signed-off-by: Xabier Napal <xabier.napal@dvzr.io>
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this PR to never become stale, please ask a maintainer to apply the "stalebot-ignore" label. |
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this PR to never become stale, please ask a maintainer to apply the "stalebot-ignore" label. |
This PR was closed because it has become stale with no activity. |
This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this PR to never become stale, please ask a maintainer to apply the "stalebot-ignore" label. |
This PR was closed because it has become stale with no activity. |
Could this be reviewed so it's not marked as stale by the bot? |
Hello @xabinapal, will take a look at this PR. Thanks for your contribution :) |
Description of changes:
While running NTH in IMDS mode on instances without an assigned public IP, I noticed that requests to certain EC2 Metadata endpoints, specifically
public-hostname
andpublic-ipv4
, return a 404 status code. This is the expected behavior, as documented here. Although NTH does not fail and works as expected in this scenario, some log messages about these 404 status codes are displayed:These messages don't clarify the reason for the 404 codes, which can mislead users (like myself!) into thinking something is wrong. To address this, I've added an
allowMissing
parameter to theGetMetadataInfo
function. When this flag is enabled, no message will be logged for 404 responses, and no error will be returned.While this might not be the most elegant solution, I felt like any other alternative, such as implementing the options pattern, would be overkill and too complex for the limited scope of the function.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.