class Aws::InstanceProfileCredentials

def http_put(connection, path, ttl)

PUT request fetch token with ttl
def http_put(connection, path, ttl)
  headers = {
    'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}",
    'x-aws-ec2-metadata-token-ttl-seconds' => ttl.to_s
  }
  response = connection.request(Net::HTTP::Put.new(path, headers))
  case response.code.to_i
  when 200
    [
      response.body,
      response.header['x-aws-ec2-metadata-token-ttl-seconds'].to_i
    ]
  when 400
    raise TokenRetrivalError
  else
    raise Non200Response
  end
end