class Aws::InstanceProfileCredentials

def get_credentials

def get_credentials
  failed_attempts = 0
  begin
    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
  rescue *FAILURES => e
    if failed_attempts < @retries
      @backoff.call(failed_attempts)
      failed_attempts += 1
      retry
    else
      '{}'
    end
  end
end