diff --git a/lib/fog/aws/credential_fetcher.rb b/lib/fog/aws/credential_fetcher.rb index 132ef92bb..90b3d0629 100644 --- a/lib/fog/aws/credential_fetcher.rb +++ b/lib/fog/aws/credential_fetcher.rb @@ -21,15 +21,15 @@ module Fog if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] connection = options[:connection] || Excon.new(CONTAINER_CREDENTIALS_HOST) credential_path = options[:credential_path] || ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] - role_data = connection.get(:path => credential_path, :expects => 200).body + role_data = connection.get(:path => credential_path, :idempotent => true, :expects => 200).body connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST) - az_data = connection.get(:path => INSTANCE_METADATA_AZ, :expects => 200).body + az_data = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body else connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST) - role_name = connection.get(:path => INSTANCE_METADATA_PATH, :expects => 200).body - role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :expects => 200).body - az_data = connection.get(:path => INSTANCE_METADATA_AZ, :expects => 200).body + role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200).body + role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200).body + az_data = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200).body end region = az_data[0..-2] # get region from az