Is there a way to do something like the following in GCF?
import pymysql
import paramiko
from sshtunnel import SSHTunnelForwarder
def hello_world(request, data=''):
with SSHTunnelForwarder(ssh_address_or_host='56.48.28.32', ssh_username='ubuntu', ssh_pkey='id_rsa', remote_bind_address=('aval.myixal.net', 3306)) as tunnel:
conn = pymysql.connect(host='127.0.0.1', user='xian', passwd='bwQi', db='avails', port=tunnel.local_bind_port)
cursor = conn.cursor()
cursor.execute('SELECT * FROM global_event LIMIT 10')
data = str(cursor.fetchone())
conn.close()
return data
I have included the id_rsa key and the requirements. This will work locally, but I'm guessing the whole 'port-forwarding' thing might be a non-starter on GCF. Is there a way to do something like the above?
