Programs that allow remote connections (usually in ssh) typically request a user name/pwd to connect to a remote server: see the below examples from sequelpro and rubymine, respectively:
Sequel pro: Attempting to connect to a remote mysql server via ssh:
Rubymine: Attempting to do server side debugging:
With Amazon AWS, to connect using SSH you need a private key, and the connection command goes something like this:
ssh -i %privateKeyFileName.pem% ubuntu@server
Question: How do I include this private file to be able to successfully connect using apps like prosql or rubymine?
Update: sequel pro can be done natively.. as for rubymine.. i started by doing ssh tunneling.. so here are the steps:
first: I started an ssh tunnel process on my machine, so that any request made to my localhost:9999 port will be forwarded to aws ip at port 3000:
ssh -l ubuntu -i '/path/to/cert/file/certFile.cer' -L 9999:%aws.ip%:3000 %aws.ip%
second: following these instructions.. i bundled the debase debug gem with my rails project.. and ran the following command:
rdebug-ide --port 3000 -- rvmsudo thin start -p 3000 -e production
third: I changed the production debug settings in my rubymine, and made it point to port 3000 in my localhost like so:
fourth: I initiated the debug process from rubymine..
problem: the debug process started.. but it's telling me that it cannot connect to the mysql server:
/Users/abdullahbakhach/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -e at_exit{sleep(1)};$stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/abdullahbakhach/.rvm/gems/ruby-1.9.3-p484/gems/ruby-debug-ide-0.4.17/bin/rdebug-ide --port 58053 --dispatcher-port 58054 -- /Users/abdullahbakhach/dev/ruby/icars-web-application-veritopia/script/rails server -b 0.0.0.0 -p 9999 -e production
Fast Debugger (ruby-debug-ide 0.4.17, ruby-debug-base19x 0.11.30.pre12) listens on 127.0.0.1:58053
=> Booting Thin
=> Rails 3.2.13 application starting in production on http://0.0.0.0:9999
=> Call with -d to detach
=> Ctrl-C to shutdown server
/Users/abdullahbakhach/.rvm/gems/ruby-1.9.3-p484@global/gems/actionpack-3.2.13/lib/action_dispatch/http/mime_type.rb:102: warning: already initialized constant PDF
Uncaught exception: Host '78.111.131.68' is not allowed to connect to this MySQL server
Exiting
/Users/abdullahbakhach/.rvm/gems/ruby-1.9.3-p484/gems/mysql2-0.3.14/lib/mysql2/client.rb:67:in `connect'
I know that if i try to connect directly to the mysql
db hosted on the aws machine directly from a random host, it will reject that connection on the same grounds. The idea is to fool the mysql db into thinking that i'm actually connecting to it from within aws..
technically i can do the same thing: i can create another ssh tunnel specifically for the mysql host, but then how do i instruct rubymine to connect to that tunnel for the db?