Skip to content

Instantly share code, notes, and snippets.

@bernard-mesa
bernard-mesa / gist:0dc94894e7ff034b9a8f
Last active August 29, 2015 14:21
Port forwarding (through bastion to AWS instances) in Ruby
require 'net/ssh'
begin
puts "Beginning"
Net::SSH.start('bastion_server_address', 'your_username', :password => 'your_password_here') do |ssh|
puts "Connected to bastion"
ssh.forward.local('localhost', 5432, 'host_address', 5432)
ssh.loop { true }
end
end