Last active
August 29, 2015 14:21
-
-
Save bernard-mesa/0dc94894e7ff034b9a8f to your computer and use it in GitHub Desktop.
Port forwarding (through bastion to AWS instances) in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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