I have a use case where I want to login via ssh to an ec2 instance from a ruby script. The reason why I am trying to do this is, we manage many instances and its painful to get the dns of each instance and then ssh into it with the pem file. Here is the gist of my code:
# bunch of logic to get the DNS name of the instance
`ssh -i GFFGFG.pem [email protected]`
When I do this it opens that in a seperate process, what I want is my ruby program and end and I should login to the instance ec2.dns.name via ssh. Is there a way to latch on the std in/out of the separate process? I tried using IO.popen but that too did not give the intended result. Any help is much appreciated.
Net::SSH::Multito handle multiple parallel connections, seems you might be interested in it.