1

I'm using MacOS, and I'm creating a process to open an ssh tunnel to an EMR cluster on creation. Due to the firewall, this is a connection that needs to be maintained for the duration you wish to look at the Spark web UI, and so I need to figure out how to:

  1. Open the ssh tunnel (and implicitly tell it include "yes" when it asks if I want to connect to this new server)
  2. Then open a web-browser to the correct port.

Here is my command I'm currently using:

               ssh = sp.Popen(
                    [
                        'ssh',
                        '-i',
                        KEY_PAIR,
                        '-ND',
                        '8157',
                        'hadoop@{host}'.format(host=master_dns)
                    ],
                    shell=False,
                    stdin=sp.PIPE,
                    stdout=sp.PIPE,
                    stderr=sp.PIPE,
                    universal_newlines=True
                )
                sleep(1)
                out, err = ssh.communicate(input='yes')
                print(out, err)
               print('URL to Yarn Manager: {url}'.format(
                    url='http://{dns}:8088'.format(dns=master_dns)
                ))
                input("Hit any key to terminate the ssh tunnel.")
                ssh.terminate()

This doesn't seem to work as it still asks me

ECDSA key fingerprint is XXXX.
Are you sure you want to continue connecting (yes/no)? 

after the fact. What would be a way to accomplish this?

flybonzai
  • 3,763
  • 11
  • 38
  • 72

0 Answers0