Skip to content

Instantly share code, notes, and snippets.

@SaschaMoellering
Created May 27, 2014 09:42
Show Gist options
  • Save SaschaMoellering/a41f37cf5a6df9324996 to your computer and use it in GitHub Desktop.
Save SaschaMoellering/a41f37cf5a6df9324996 to your computer and use it in GitHub Desktop.
require 'net/http'
uri = URI.parse('http://169.254.169.254/latest/meta-data/instance-id')
begin
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri.request_uri
http.open_timeout = 5
respone = http.request request
end
rescue Exception => e
puts e.message
puts e.class
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment