class Aws::InstanceProfileCredentials

def fetch_token(conn)

def fetch_token(conn)
  retry_errors(NETWORK_ERRORS, max_retries: @retries) do
    unless token_set?
      created_time = Time.now
      token_value, ttl = http_put(
        conn, METADATA_TOKEN_PATH, @token_ttl
      )
      @token = Token.new(token_value, ttl, created_time) if token_value && ttl
    end
  end
rescue *NETWORK_ERRORS
  # token attempt failed, reset token
  # fallback to non-token mode
  @token = nil
  @imds_v1_fallback = true
end