Repository navigation
Fix tmds response for unavailable credentials upon agent restart - #4833
Merged
Merged
Conversation
singholt
force-pushed
the
tmds-creds-fix
branch
18 times, most recently
from
January 6, 2026 22:52
aa65533 to
e09178d
Compare
singholt
force-pushed
the
tmds-creds-fix
branch
from
January 6, 2026 23:33
e09178d to
d600826
Compare
singholt
marked this pull request as ready for review
January 6, 2026 23:44
amogh09
reviewed
Jan 7, 2026
singholt
force-pushed
the
tmds-creds-fix
branch
from
January 7, 2026 01:09
d600826 to
7ce5c01
Compare
singholt
force-pushed
the
tmds-creds-fix
branch
from
January 7, 2026 01:10
7ce5c01 to
fcad371
Compare
ShelbyZ
approved these changes
Jan 7, 2026
mye956
reviewed
Jan 7, 2026
mye956
approved these changes
Jan 7, 2026
prateekchaudhry
approved these changes
Jan 7, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes the error that a container sees when it requests credentials over the TMDS credentials endpoint (
169.254.170.2$AWS_CONTAINER_CREDENTIALS_RELATIVE_URI), when the credentials are unavailable.The agent does not save task IAM role and task execution IAM role credentials to its state. So when an agent restart occurs, the agent needs ACS to resend the credentials. Until ACS does so, the agent must return a meaningful error code and reason in the response. Currently, customer would see a error code 400 (Invalid credentials ID), whereas they should see a 503 (credentials uninitialized).
The TMDS handler does have logic in place to throw 503 under such conditions but it is broken. This PR fixes it.
Implementation details
CredentialsIDin the task object. When the agent saves the task object in its state file, this change helps store the credentials ID field as well. This makes it consistent with how agent saves the execution role credentials ID to its state.Testing
New tests cover the changes: yes
Added unit tests and also manually tested the scenario as described below.
Steps to reproduce the issue:
Description for the changelog
Bugfix: Fix tmds response for unavailable credentials upon agent restart.
Additional Information
Does this PR include breaking model changes? If so, Have you added transformation functions? No
Does this PR include the addition of new environment variables in the README? No
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.