Skip to content

Instantly share code, notes, and snippets.

@bernard-mesa
Last active August 29, 2015 14:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bernard-mesa/0dc94894e7ff034b9a8f to your computer and use it in GitHub Desktop.
Save bernard-mesa/0dc94894e7ff034b9a8f to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment