class Aws::InstanceProfileCredentials

def get_credentials

def get_credentials
  # Retry loading credentials a configurable number of times if
  # the instance metadata service is not responding.
  begin
    retry_errors(NETWORK_ERRORS, max_retries: @retries) do
      open_connection do |conn|
        path = '/latest/meta-data/iam/security-credentials/'
        profile_name = http_get(conn, path).lines.first.strip
        http_get(conn, path + profile_name)
      end
    end
  rescue
    '{}'
  end
end