Skip to content

Support IMDS V2.1 #3255

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

Closed
wants to merge 52 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
a211c53
Remove IMDSv1 mechanism in InstanceProfileCreds
jterapin Jun 2, 2025
7f0126d
Use ec2 metadata client to fetch credentials for instance profile
jterapin Jun 5, 2025
22c1bec
Fix handling of parsing creds
jterapin Jun 5, 2025
9a5410d
Clean up
jterapin Jun 5, 2025
bca31d5
Tidy up existing code
jterapin Jun 6, 2025
bf2fabb
Fix doc warning
jterapin Jun 6, 2025
2c5cca4
Add new config opts
jterapin Jun 6, 2025
350c6f3
Merge branch 'version-3' into imds_update
jterapin Jun 6, 2025
f018568
Minor doc fixes
jterapin Jun 6, 2025
5323f6c
IMDS 2.1 refactor
jterapin Jun 11, 2025
7527feb
Fix failing credential resolution chain specs
jterapin Jun 11, 2025
7349b61
Update shared config and its specs
jterapin Jun 11, 2025
b1de27f
Update chain specs
jterapin Jun 11, 2025
8f11f99
Update ec2 metadata specs
jterapin Jun 11, 2025
de3c2ca
Clean up ec2 metadata
jterapin Jun 11, 2025
82d5dd1
Minor update to EC2 metadata specs
jterapin Jun 11, 2025
f8a25e3
Clean up IMDS provider
jterapin Jun 11, 2025
89d42ba
Small update
jterapin Jun 11, 2025
2951add
Merge branch 'version-3' into imds_update
jterapin Jun 11, 2025
5cb5a41
Changelog draft
jterapin Jun 11, 2025
3856e44
Add back attribute
jterapin Jun 11, 2025
5f59afa
More tidyness
jterapin Jun 11, 2025
42ca582
Remove json checks
jterapin Jun 12, 2025
ff0500d
Remove redunant boolean expressions from disable ec2 metadata check
jterapin Jun 12, 2025
ba66dab
Update docs rendering for ec2 metadata
jterapin Jun 12, 2025
da697a7
Update EC2 specs
jterapin Jun 12, 2025
efce766
Remove trailing comma
jterapin Jun 12, 2025
0f9217d
Some feedback updates
jterapin Jun 12, 2025
ff4b2bd
Update outdated doc links
jterapin Jun 13, 2025
37d5cc5
Update imds provider
jterapin Jun 13, 2025
84762d1
update specs
jterapin Jun 13, 2025
d3ed775
Address feedbacks
jterapin Jun 13, 2025
e39fd9d
Minor clean up
jterapin Jun 13, 2025
f107214
Update changelog
jterapin Jun 13, 2025
4f55b42
Small clean up on chain
mullermp Jun 13, 2025
f759f7e
Add back some ec2metadata tests
mullermp Jun 13, 2025
168e077
Clean up of instance profile credentials
mullermp Jun 13, 2025
ac54816
Minor updates
jterapin Jun 13, 2025
ba05271
Add test runner
jterapin Jun 14, 2025
a4aabe7
Minor clean ups
jterapin Jun 14, 2025
3e38139
Fix ruby 2.7
mullermp Jun 14, 2025
aba9a45
WIP - test issues
mullermp Jun 14, 2025
dffaeb1
Add tests verbatum
mullermp Jun 14, 2025
e0d2224
Fix resolution tests
mullermp Jun 14, 2025
15f1b0d
socket error for extended path across all specs
mullermp Jun 14, 2025
5d37ab7
Update IMDS provider
jterapin Jun 14, 2025
8ab5bcd
Rubocop
jterapin Jun 16, 2025
004944d
Add json parser specs
jterapin Jun 16, 2025
93e191a
Fix docs
jterapin Jun 16, 2025
8cff23d
Merge branch 'version-3' into imds_update
mullermp Jun 18, 2025
ab6d4b0
Update based on feedbacks
jterapin Jun 18, 2025
2bfb830
Merge branch 'version-3' into imds_update
jterapin Jun 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tidy up existing code
  • Loading branch information
jterapin committed Jun 6, 2025
commit bca31d5f94893136b57943e602187fb02169d5c0
6 changes: 2 additions & 4 deletions gems/aws-sdk-core/lib/aws-sdk-core/ec2_metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,8 @@ def http_put(connection, ttl)
response.body,
response.header['x-aws-ec2-metadata-token-ttl-seconds'].to_i
]
when 400
raise TokenRetrievalError
when 403
raise RequestForbiddenError
when 400 then raise TokenRetrievalError
when 403 then raise RequestForbiddenError
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def refresh
end

def fetch_credentials
return '{}' if _metadata_disabled?
return '{}' if metadata_disabled?

metadata = @client.get(METADATA_PATH_BASE)
profile_name = metadata.lines.first.strip
Expand All @@ -143,7 +143,7 @@ def update_credentials(creds)
warn_expired_credentials
end

def _metadata_disabled?
def metadata_disabled?
ENV.fetch('AWS_EC2_METADATA_DISABLED', 'false').downcase == 'true'
end

Expand Down