Skip to content

Commit 133e708

Browse files
authored
Refactor IMDS credentials provider (#3267)
1 parent 4fb4f3d commit 133e708

File tree

7 files changed

+270
-391
lines changed

7 files changed

+270
-391
lines changed

gems/aws-sdk-core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Skip `Aws::InstanceProfileCredentials` instantiation when `ENV['AWS_EC2_METADATA_DISABLED']` is set to `true` in the credential resolution chain.
5+
6+
* Issue - Refactor `InstanceProfileCredentials` to improve code clarity and documentation.
7+
48
3.226.2 (2025-07-01)
59
------------------
610

gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def instance_profile_credentials(options)
191191
if ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] ||
192192
ENV['AWS_CONTAINER_CREDENTIALS_FULL_URI']
193193
ECSCredentials.new(options)
194-
else
194+
elsif !(ENV.fetch('AWS_EC2_METADATA_DISABLED', 'false').downcase == 'true')
195195
InstanceProfileCredentials.new(options.merge(profile: profile_name))
196196
end
197197
end

0 commit comments

Comments
 (0)