SSHHook

SSH

Hook for ssh remote execution using Paramiko. ref: https://github.com/paramiko/paramiko This hook also lets you create ssh tunnel and serve as basis for SFTP file transfer

View on GitHub

Last Updated: Mar. 21, 2023

Access Instructions

Install the SSH provider package into your Airflow environment.

Import the module into your DAG file and instantiate it with your desired params.

Parameters

ssh_conn_idssh connection id from airflow Connections from where all the required parameters can be fetched like username, password or key_file, though priority is given to the params passed during init.
remote_hostremote host to connect
usernameusername to connect to the remote_host
passwordpassword of the username to connect to the remote_host
key_filepath to key file to use to connect to the remote_host
portport of remote host to connect (Default is paramiko SSH_PORT)
conn_timeouttimeout (in seconds) for the attempt to connect to the remote_host. The default is 10 seconds. If provided, it will replace the conn_timeout which was predefined in the connection of ssh_conn_id.
timeout(Deprecated). timeout for the attempt to connect to the remote_host. Use conn_timeout instead.
cmd_timeouttimeout (in seconds) for executing the command. The default is 10 seconds. Nullable, None means no timeout. If provided, it will replace the cmd_timeout which was predefined in the connection of ssh_conn_id.
keepalive_intervalsend a keepalive packet to remote host every keepalive_interval seconds
banner_timeouttimeout to wait for banner from the server in seconds
disabled_algorithmsdictionary mapping algorithm type to an iterable of algorithm identifiers, which will be disabled for the lifetime of the transport
cipherslist of ciphers to use in order of preference

Documentation

Hook for ssh remote execution using Paramiko. ref: https://github.com/paramiko/paramiko This hook also lets you create ssh tunnel and serve as basis for SFTP file transfer

Was this page helpful?